我甚至无法获得一个以Quest 2平台为目标的空虚幻项目来构建没有错误的Android目标。这似乎与各种相互不兼容的Java/SDK/NDK/Gradle版本的混乱有关,我找不到一个有效的组合。这是我目前根据Unreal:中的Android Studio和Android SDK平台设置使用的内容
android sdk:
- 已安装API 28级
- 已安装API 30级
- 已安装API 31级
- SDK生成工具31已安装,但随后被删除,因为生成报告了损坏的版本
- SDK构建工具30.0.3已安装
- SDK构建工具29.0.2已安装
- 为SDK API级别
latest
配置了虚幻环境 - Unreal项目配置为目标SDK版本28(最低23(
- 我已经在
D:/android-sdk
明确提供了Unreal Platform Android SDK设置的位置,该位置与Android Studio中指定的位置匹配,但Android Studio使用,Unreal使用
/
android ndk:
- 我安装了22.1.7171670
- 我已在
D:/android-sdk/ndk/22.1.7171670
向Unreal明确提供了位置 - 我已告知虚幻使用NDK API
latest
级
java:
- 我在D:\Java上安装了JDK 16.0.1
- 我已经明确告诉Unreal Android SDK设置使用
D:/Java
中的JAVA
梯度:
- 我更新了UE_4.26\Engine\Build\Android\Java\gradle\gradle\uwrapper\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
当我尝试在这个环境中构建一个项目时(使用文件>包项目>安卓>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:UsersbluemDocumentsUnreal ProjectsQuest2TestIntermediateAndroidarmv7gradlerungradle.bat" :app:assembleDebug
UATHelper: Packaging (Android (Multi:ASTC,DXT,ETC2)): (see C:UsersbluemAppDataRoamingUnreal EngineAutomationToolLogsD+Games+Epic+UE_4.26Log.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_librarybuildgeneratedap_generated_sourcesdebugout)) 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:UsersbluemDocumentsUnreal ProjectsQuest2TestIntermediateAndroidarmv7gradlerungradle.bat" :app:assembleDebug
UATHelper: Packaging (Android (Multi:ASTC,DXT,ETC2)): (see C:UsersbluemAppDataRoamingUnreal EngineAutomationToolLogsD+Games+Epic+UE_4.26Log.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版本更改回30,那么我会再次得到原始错误,这次目标SDK版本设置为30。因此,JDK版本似乎是罪魁祸首,但需要更改Target SDK版本才能强制重建某些内容,尽管我有"完全重建";在"项目打包设置"中选择。
问题
所以我的问题是,我该如何克服这两个错误?
- 无法使字段私有的最终java.lang.String java.io.File.path可访问:模块java.base不"打开java.io";至未命名模块@5caa5e6c
- 查询映射的映射值(java.io.File属性(org.gradle.api.File.Directory,fixed(类org.gradle/ai.internal.File.DefaultFilePropertyFactory$FixedDirectory,Z:\downloader_brary\build\generated\ap_generated_sources\debug\out((org.gradle_api.internal.File.DefaultFileProperty工厂$ToFileTransformer@2ccc294e)不支持在任务":downloader_brary:compileDebugJavaWithJavac"完成之前
需要将Gradle降级回distributionUrl=https://services.gradle.org/distributions/gradle-6.1.1-all.zip
这只起过一次作用。我无法使用相同的设置重新生成。似乎存在一些时间问题,可能需要等待https://github.com/gradle/gradle/issues/16777以便克服错误。每次构建时,我都会看到不同的错误。我至少看到了6个不同的错误。在删除中间目录和已保存目录后,我在第二次尝试中成功构建了这些目录。
似乎需要jdk1.8.0_321而不是JDK16/17。这让我能够始终如一地为Quest构建(我没有Quest 2,但它也应该在那里工作(
除此之外,你在这里提供的所有设置都解决了我的问题。