我什至无法获得一个针对 Quest 2 平台的空虚幻项目来无错误地构建 Android 目标。这似乎与各种互不兼容的Java / SDK / NDK / Gradle版本的混乱有关,我找不到可行的组合。根据 Unreal 中的 Android Studio 和 Android SDK Platform 设置,这是我目前使用的:
安卓SDK:
- 已安装 API 级别 28
- 已安装 API 级别 30
- 已安装 API 级别 31
- SDK Build Tools 31 已安装,但随后被删除,因为构建报告了损坏的版本
- 已安装 SDK 构建工具 30.0.3
- 已安装 SDK 构建工具 29.0.2
- 为 SDK API 级别配置虚幻环境
latest
- 虚幻项目配置为面向 SDK 版本 28(最低 23)
- 我已明确向 Unreal Platform Android SDK 设置提供了
D:/android-sdk
与 Android Studio 中指定的位置匹配的位置,除了 Android Studio uses\
和 Unreal uses/
。
安卓 NDK:
- 我安装了 22.1.7171670
- 我已经明确向虚幻提供了位置
D:/android-sdk/ndk/22.1.7171670
- 我已经告诉 Unreal 使用 NDK API Level
latest
爪哇:
- 我在 D:\Java 安装了 JDK 16.0.1
- 我已经明确告诉 Unreal Android SDK 设置使用 JAVA
D:/Java
摇篮:
- 我更新了我的 UE_4.26\Engine\Build\Android\Java\gradle\gradle\wrapper\gradle-wrapper.properties 文件以引用
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0-bin.zip
并注释掉,#distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
因为我现在不记得其他一些错误。
当我尝试在此环境中构建项目时(使用 File > Package Project > Android > Android (Multi: ASTC, DXT, ETC2),我的输出结束如下所示:
UATHelper: Packaging (Android (Multi:ASTC,DXT,ETC2)): FAILURE: Build failed with an exception.
UATHelper: Packaging (Android (Multi:ASTC,DXT,ETC2)): * What went wrong:
UATHelper: Packaging (Android (Multi:ASTC,DXT,ETC2)): Execution failed for task ':app:processDebugManifest'.
UATHelper: Packaging (Android (Multi:ASTC,DXT,ETC2)): > Unable to make field private final java.lang.String java.io.File.path accessible: module java.base does not "opens java.io" to unnamed module @5caa5e6c
UATHelper: Packaging (Android (Multi:ASTC,DXT,ETC2)): * Try:
UATHelper: Packaging (Android (Multi:ASTC,DXT,ETC2)): Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
UATHelper: Packaging (Android (Multi:ASTC,DXT,ETC2)): * Get more help at https://help.gradle.org
UATHelper: Packaging (Android (Multi:ASTC,DXT,ETC2)): Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
UATHelper: Packaging (Android (Multi:ASTC,DXT,ETC2)): Use '--warning-mode all' to show the individual deprecation warnings.
UATHelper: Packaging (Android (Multi:ASTC,DXT,ETC2)): See https://docs.gradle.org/7.0/userguide/command_line_interface.html#sec:command_line_warnings
UATHelper: Packaging (Android (Multi:ASTC,DXT,ETC2)): BUILD FAILED in 10s
UATHelper: Packaging (Android (Multi:ASTC,DXT,ETC2)): 16 actionable tasks: 1 executed, 15 up-to-date
UATHelper: Packaging (Android (Multi:ASTC,DXT,ETC2)): ERROR: cmd.exe failed with args /c "C:\Users\bluem\Documents\Unreal Projects\Quest2Test\Intermediate\Android\armv7\gradle\rungradle.bat" :app:assembleDebug
UATHelper: Packaging (Android (Multi:ASTC,DXT,ETC2)): (see C:\Users\bluem\AppData\Roaming\Unreal Engine\AutomationTool\Logs\D+Games+Epic+UE_4.26\Log.txt for full exception trace)
UATHelper: Packaging (Android (Multi:ASTC,DXT,ETC2)): AutomationTool exiting with ExitCode=1 (Error_Unknown)
UATHelper: Packaging (Android (Multi:ASTC,DXT,ETC2)): BUILD FAILED
我将 SDK 目标从 28 更改为 30 并将 JAVA 目录从更改D:/Java
为C:/Program Files/Java/jdk1.8.0_161
,然后错误更改:
UATHelper: Packaging (Android (Multi:ASTC,DXT,ETC2)): FAILURE: Build failed with an exception.
UATHelper: Packaging (Android (Multi:ASTC,DXT,ETC2)): * What went wrong:
UATHelper: Packaging (Android (Multi:ASTC,DXT,ETC2)): Execution failed for task ':downloader_library:compileDebugJavaWithJavac'.
UATHelper: Packaging (Android (Multi:ASTC,DXT,ETC2)): > Failed to query the value of task ':downloader_library:compileDebugJavaWithJavac' property 'options.generatedSourceOutputDirectory'.
UATHelper: Packaging (Android (Multi:ASTC,DXT,ETC2)): > Querying the mapped value of map(java.io.File property(org.gradle.api.file.Directory, fixed(class org.gradle.api.internal.file.DefaultFilePropertyFactory$FixedDirectory, Z:\downloader_library\build\generated\ap_generated_sources\debug\out)) org.gradle.api.internal.file.DefaultFilePropertyFactory$ToFi
leTransformer@2ccc294e) before task ':downloader_library:compileDebugJavaWithJavac' has completed is not supported
UATHelper: Packaging (Android (Multi:ASTC,DXT,ETC2)): * Try:
UATHelper: Packaging (Android (Multi:ASTC,DXT,ETC2)): Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
UATHelper: Packaging (Android (Multi:ASTC,DXT,ETC2)): * Get more help at https://help.gradle.org
UATHelper: Packaging (Android (Multi:ASTC,DXT,ETC2)): BUILD FAILED in 25s
UATHelper: Packaging (Android (Multi:ASTC,DXT,ETC2)): Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
UATHelper: Packaging (Android (Multi:ASTC,DXT,ETC2)): Use '--warning-mode all' to show the individual deprecation warnings.
UATHelper: Packaging (Android (Multi:ASTC,DXT,ETC2)): See https://docs.gradle.org/7.0/userguide/command_line_interface.html#sec:command_line_warnings
UATHelper: Packaging (Android (Multi:ASTC,DXT,ETC2)): 44 actionable tasks: 6 executed, 38 up-to-date
UATHelper: Packaging (Android (Multi:ASTC,DXT,ETC2)): ERROR: cmd.exe failed with args /c "C:\Users\bluem\Documents\Unreal Projects\Quest2Test\Intermediate\Android\armv7\gradle\rungradle.bat" :app:assembleDebug
UATHelper: Packaging (Android (Multi:ASTC,DXT,ETC2)): (see C:\Users\bluem\AppData\Roaming\Unreal Engine\AutomationTool\Logs\D+Games+Epic+UE_4.26\Log.txt for full exception trace)
UATHelper: Packaging (Android (Multi:ASTC,DXT,ETC2)): AutomationTool exiting with ExitCode=1 (Error_Unknown)
UATHelper: Packaging (Android (Multi:ASTC,DXT,ETC2)): BUILD FAILED
如果我将这两个设置中的一个或两个更改回它们以前的值,则错误不会变回第一个错误。如果我随后将 Target SDK 版本(再次)更改回 30,那么我再次收到原始错误,这次将 Target SDK 版本设置为 30。所以看起来 JDK 版本是罪魁祸首,但更改了 Target SDK 版本尽管我在项目打包设置中选择了“完全重建”,但仍需要强制重建某些东西。
问题
所以我的问题是,我如何克服这两个错误?
- 无法使字段私有最终 java.lang.String java.io.File.path 可访问:模块 java.base 不会“打开 java.io”到未命名模块 @5caa5e6c
- 查询map的映射值(java.io.File property(org.gradle.api.file.Directory, fixed(class org.gradle.api.internal.file.DefaultFilePropertyFactory$FixedDirectory, Z:\downloader_library\build\generated\ ap_generated_sources\debug\out)) org.gradle.api.internal.file.DefaultFilePropertyFactory$ToFileTransformer@2ccc294e) 在任务 ':downloader_library:compileDebugJavaWithJavac' 完成之前不受支持