无法设置新的 Unreal & Quest 2 开发环境
Unable to set up new Unreal & Quest 2 development environment
我什至无法获得一个针对 Quest 2 平台的空虚幻项目来构建 Android 目标而不会出现错误。这似乎与相互不兼容的各种 Java / SDK / NDK / Gradle 版本混乱有关,我找不到合适的组合。
这是我目前根据 Android Studio 和 Android Unreal 中的 SDK 平台设置使用的:
Android SDK:
- API 已安装 28 级
- API 已安装 30 级
- API 31 级已安装
- SDK Build Tools 31 已安装,但随后被删除,因为构建报告了损坏的版本
- SDK 构建工具 30.0.3 已安装
- SDK 构建工具 29.0.2 已安装
- Unreal环境为SDK配置API级别
latest
- 虚幻项目配置为目标 SDK 版本 28(最低 23)
- 我已在
D:/android-sdk
明确提供虚幻平台 Android SDK 设置的位置,该位置与 Android Studio 中指定的位置相匹配,除了 Android Studio 使用 \
而 Unreal 使用 /
.
Android NDK:
- 我安装了 22.1.7171670
- 我已在
D:/android-sdk/ndk/22.1.7171670
明确向 Unreal 提供位置
- 我已经告诉Unreal使用NDKAPI级别
latest
Java:
- 我在 D:\Java
安装了 JDK 16.0.1
- 我已经明确告诉 Unreal Android SDK 设置使用来自
D:/Java
的 JAVA
Gradle:
- 我更新了我的 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
因为一些我现在不记得的其他错误.
当我尝试在此环境中构建项目时(使用文件 > 打包项目 > 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 target从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 版本是罪魁祸首,但改变尽管我在项目打包设置中选择了“完全重建”,但仍需要目标 SDK 版本来强制重建某些内容。
问题
所以我的问题是,如何克服这两个错误?
- 无法使字段私有最终 java.lang.String java.io.File.path 可访问:模块 java.base 不会“打开 java.io” 未命名模块 @5caa5e6c
- 查询map(java.io.File 属性(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' 完成之前不受支持
需要将 Gradle 降级回 distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
那只奏效了一次。我无法使用相同的设置再次构建。似乎存在一些时间问题,可能需要等待 https://github.com/gradle/gradle/issues/16777 得到解决才能克服错误。每次构建时,我都会看到不同的错误。我已经看到至少 6 个不同的错误。删除 Intermediate 和 Saved 目录后,我第二次尝试构建成功。
似乎需要 jdk1.8.0_321 而不是 JDK16/17。这使我能够始终如一地为 Quest 进行构建(我没有 Quest 2,但它也应该在那里工作)
除此之外,您在此处提供的所有设置都解决了我的问题。
我什至无法获得一个针对 Quest 2 平台的空虚幻项目来构建 Android 目标而不会出现错误。这似乎与相互不兼容的各种 Java / SDK / NDK / Gradle 版本混乱有关,我找不到合适的组合。 这是我目前根据 Android Studio 和 Android Unreal 中的 SDK 平台设置使用的:
Android SDK:
- API 已安装 28 级
- API 已安装 30 级
- API 31 级已安装
- SDK Build Tools 31 已安装,但随后被删除,因为构建报告了损坏的版本
- SDK 构建工具 30.0.3 已安装
- SDK 构建工具 29.0.2 已安装
- Unreal环境为SDK配置API级别
latest
- 虚幻项目配置为目标 SDK 版本 28(最低 23)
- 我已在
D:/android-sdk
明确提供虚幻平台 Android SDK 设置的位置,该位置与 Android Studio 中指定的位置相匹配,除了 Android Studio 使用\
而 Unreal 使用/
.
Android NDK:
- 我安装了 22.1.7171670
- 我已在
D:/android-sdk/ndk/22.1.7171670
明确向 Unreal 提供位置
- 我已经告诉Unreal使用NDKAPI级别
latest
Java:
- 我在 D:\Java 安装了 JDK 16.0.1
- 我已经明确告诉 Unreal Android SDK 设置使用来自
D:/Java
的 JAVA
Gradle:
- 我更新了我的 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
因为一些我现在不记得的其他错误.
当我尝试在此环境中构建项目时(使用文件 > 打包项目 > 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 target从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 版本是罪魁祸首,但改变尽管我在项目打包设置中选择了“完全重建”,但仍需要目标 SDK 版本来强制重建某些内容。
问题
所以我的问题是,如何克服这两个错误?
- 无法使字段私有最终 java.lang.String java.io.File.path 可访问:模块 java.base 不会“打开 java.io” 未命名模块 @5caa5e6c
- 查询map(java.io.File 属性(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' 完成之前不受支持
需要将 Gradle 降级回 distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
那只奏效了一次。我无法使用相同的设置再次构建。似乎存在一些时间问题,可能需要等待 https://github.com/gradle/gradle/issues/16777 得到解决才能克服错误。每次构建时,我都会看到不同的错误。我已经看到至少 6 个不同的错误。删除 Intermediate 和 Saved 目录后,我第二次尝试构建成功。
似乎需要 jdk1.8.0_321 而不是 JDK16/17。这使我能够始终如一地为 Quest 进行构建(我没有 Quest 2,但它也应该在那里工作)
除此之外,您在此处提供的所有设置都解决了我的问题。