添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

I’m trying to build on Android, with UE 5.3 from the engine source.

I’ve got my setup, and it’s worked for 5.2 and back but seems to run into an issue with Gradle in 5.3.

Could not resolve com.android.tools.build:gradle:7.4.2.

This was the only informative error message. It’s weird though because the logs indicate that it’s trying to use Gradle 7.5, but I’ve got nothing on my machine that has installed Gradle 7.5 nor specifically lists Gradle 7.5.

I’ve run the SetupAndroid.bat files, checked every bit of documentation and googled my issue into the ground. I’ve uninstalled and reinstalled Android Studio multiple times, checked every environment variable.

I’m at a complete loss, especially since I’ve been able to successfully build in 5.2, all the way back to 4.26.

Get the same error using source build from ue5-main, version: [c55a60b]

UATHelper: 打包 (Android (ASTC)): ====2023-08-23-周三 16:23:09====PERFORMING FINAL APK PACKAGE OPERATION=====arm64===========================================
UATHelper: 打包 (Android (ASTC)): Copying C:\Code\UnrealProjects\TestAndroid1\Intermediate\Android\arm64\AndroidManifest.xml to C:\Code\UnrealProjects\TestAndroid1\Intermediate\Android\arm64\gradle\app\src\main\AndroidManifest.xml
UATHelper: 打包 (Android (ASTC)): Creating rungradle.bat to work around commandline length limit (using unused drive letter Z:)
UATHelper: 打包 (Android (ASTC)): Making .apk with Gradle…
UATHelper: 打包 (Android (ASTC)): To honour the JVM settings for this build a single-use Daemon process will be forked. See The Gradle Daemon .
UATHelper: 打包 (Android (ASTC)): Daemon will be stopped at the end of the build
UATHelper: 打包 (Android (ASTC)): FAILURE: Build failed with an exception.
UATHelper: 打包 (Android (ASTC)): * What went wrong:
UATHelper: 打包 (Android (ASTC)): A problem occurred configuring root project ‘app’.
UATHelper: 打包 (Android (ASTC)): > Could not resolve all files for configuration ‘:classpath’.
UATHelper: 打包 (Android (ASTC)): > Could not resolve com.android.tools.build:gradle:7.4.2.
UATHelper: 打包 (Android (ASTC)): Required by:
UATHelper: 打包 (Android (ASTC)): project :
UATHelper: 打包 (Android (ASTC)): > No matching variant of com.android.tools.build:gradle:7.4.2 was found. The consumer was configured to find a runtime of a library compatible with Java 8, packaged as a jar, and its dependencies declared externally, as well as attribute ‘org.gradle.plugin.api-version’ with value ‘7.5’ but:
UATHelper: 打包 (Android (ASTC)): - Variant ‘apiElements’ capability com.android.tools.build:gradle:7.4.2 declares a library, packaged as a jar, and its dependencies declared externally:
UATHelper: 打包 (Android (ASTC)): - Incompatible because this component declares an API of a component compatible with Java 11 and the consumer needed a runtime of a component compatible with Java 8
UATHelper: 打包 (Android (ASTC)): - Other compatible attribute:
UATHelper: 打包 (Android (ASTC)): - Doesn’t say anything about org.gradle.plugin.api-version (required ‘7.5’)
UATHelper: 打包 (Android (ASTC)): - Variant ‘javadocElements’ capability com.android.tools.build:gradle:7.4.2 declares a runtime of a component, and its dependencies declared externally:
UATHelper: 打包 (Android (ASTC)): - Incompatible because this component declares documentation and the consumer needed a library
UATHelper: 打包 (Android (ASTC)): - Other compatible attributes:
UATHelper: 打包 (Android (ASTC)): - Doesn’t say anything about its target Java version (required compatibility with Java 8)
UATHelper: 打包 (Android (ASTC)): - Doesn’t say anything about its elements (required them packaged as a jar)
UATHelper: 打包 (Android (ASTC)): - Doesn’t say anything about org.gradle.plugin.api-version (required ‘7.5’)
UATHelper: 打包 (Android (ASTC)): - Variant ‘runtimeElements’ capability com.android.tools.build:gradle:7.4.2 declares a runtime of a library, packaged as a jar, and its dependencies declared externally:
UATHelper: 打包 (Android (ASTC)): - Incompatible because this component declares a component compatible with Java 11 and the consumer needed a component compatible with Java 8
UATHelper: 打包 (Android (ASTC)): - Other compatible attribute:
UATHelper: 打包 (Android (ASTC)): - Doesn’t say anything about org.gradle.plugin.api-version (required ‘7.5’)
UATHelper: 打包 (Android (ASTC)): - Variant ‘sourcesElements’ capability com.android.tools.build:gradle:7.4.2 declares a runtime of a component, and its dependencies declared externally:
UATHelper: 打包 (Android (ASTC)): - Incompatible because this component declares documentation and the consumer needed a library
UATHelper: 打包 (Android (ASTC)): - Other compatible attributes:
UATHelper: 打包 (Android (ASTC)): - Doesn’t say anything about its target Java version (required compatibility with Java 8)
UATHelper: 打包 (Android (ASTC)): - Doesn’t say anything about its elements (required them packaged as a jar)
UATHelper: 打包 (Android (ASTC)): - Doesn’t say anything about org.gradle.plugin.api-version (required ‘7.5’)
UATHelper: 打包 (Android (ASTC)): * Try:
UATHelper: 打包 (Android (ASTC)): > Run with --stacktrace option to get the stack trace.
UATHelper: 打包 (Android (ASTC)): > Run with --info or --debug option to get more log output.
UATHelper: 打包 (Android (ASTC)): > Run with --scan to get full insights.
UATHelper: 打包 (Android (ASTC)): * Get more help at https://help.gradle.org
UATHelper: 打包 (Android (ASTC)): BUILD FAILED in 3s
UATHelper: 打包 (Android (ASTC)): cmd.exe failed with args /c “C:\Code\UnrealProjects\TestAndroid1\Intermediate\Android\arm64\gradle\rungradle.bat” :app:assembleDebug
UATHelper: 打包 (Android (ASTC)): (see D:\Code\GitHub\UnrealEngine\Engine\Programs\AutomationTool\Saved\Logs\Log.txt for full exception trace)
UATHelper: 打包 (Android (ASTC)): AutomationTool executed for 0h 0m 34s
UATHelper: 打包 (Android (ASTC)): AutomationTool exiting with ExitCode=1 (Error_Unknown)
UATHelper: 打包 (Android (ASTC)): BUILD FAILED
PackagingResults: Error: Unknown Error

I did actually manage to get it building.
The Android documentation going into 5.3 will need quite a bit of overhauling to explain the bigger issue.

In the SetupAndroid.bat, it’s actually now setting pretty much all of the environment variables for you instead of you having to do them yourself, with the exception of your ANDROID_HOME is set.

The default setup will only support Android 32 and newer. Because of this, you will need to install Java 11 and make sure that JAVA_HOME is pointing to that location.
Mine is C:\Program Files\Android\Android Studio\jbr . Also, I know the Android setup page tells you do change SetupAndroid.bat to use the path to 8.0 instead of latest, but make sure you leave it on latest.

You can run the SetupAndroid.bat with parameters for older versions if you’d like, and if you do, make sure your JAVA_HOME is pointing to the correct place.

I hope this helps.

My 5.2 setup did not work going into 5.3. But my environment is also a little messy as I have to constantly move between UE5 and UE4 and there are things that just don’t get along. 5.2 is when the SetupAndroid.bat changed, but I guess in some cases it played just fine because the Gradle plugin requirements?

So I changed the SetupAndroid.bat to latest instead of 8.0

In AndroidStudio I installed Command-line Tools (latest) 11.0
SDK Manager/SDK Tools/ Also needed to check Show Package Details
Don’t know if that step is necessary to be honest

Installed JDK17