# Packing for Android in 5.3 targets Gradle 7.4.2 but pulls 7.5

**URL:** <https://forums.unrealengine.com/t/packing-for-android-in-5-3-targets-gradle-7-4-2-but-pulls-7-5/1266827>\
**Category:** Platform & Builds\
**Tags:** UE-5, gradle, unreal-engine, UE5, Android, question\
**Created:** [August 20, 2023, 4:27pm UTC](https://forums.unrealengine.com/t/packing-for-android-in-5-3-targets-gradle-7-4-2-but-pulls-7-5/1266827 "2023-08-20T16:27:13Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![DevChagrins](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@DevChagrins](https://forums.unrealengine.com/u/DevChagrins)\
**Post date:** [August 20, 2023, 4:27pm UTC](https://forums.unrealengine.com/t/packing-for-android-in-5-3-targets-gradle-7-4-2-but-pulls-7-5/1266827/1 "2023-08-20T16:27:13Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![zhaojunmeng](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@zhaojunmeng](https://forums.unrealengine.com/u/zhaojunmeng)\
**Post date:** [August 23, 2023, 8:27am UTC](https://forums.unrealengine.com/t/packing-for-android-in-5-3-targets-gradle-7-4-2-but-pulls-7-5/1266827/2 "2023-08-23T08:27:17Z")

</div>

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](https://docs.gradle.org/7.5/userguide/gradle_daemon.html#sec:disabling_the_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](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

---

<div class="post-metadata">

**Author:** ![NS\_LeeSeungHwan](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/ns_leeseunghwan/32/1066481_2.png) [@NS\_LeeSeungHwan](https://forums.unrealengine.com/u/NS_LeeSeungHwan)\
**Post date:** [August 24, 2023, 2:33am UTC](https://forums.unrealengine.com/t/packing-for-android-in-5-3-targets-gradle-7-4-2-but-pulls-7-5/1266827/3 "2023-08-24T02:33:31Z")

</div>

I experienced the same thing and fixed it by changing the Java version to 17.

---

<div class="post-metadata">

**Author:** ![I.PUBG.I](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@I.PUBG.I](https://forums.unrealengine.com/u/I.PUBG.I)\
**Post date:** [August 24, 2023, 7:15pm UTC](https://forums.unrealengine.com/t/packing-for-android-in-5-3-targets-gradle-7-4-2-but-pulls-7-5/1266827/4 "2023-08-24T19:15:03Z")

</div>

how did you change it? from where? please provide the steps to help the people

---

<div class="post-metadata">

**Author:** ![DevChagrins](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@DevChagrins](https://forums.unrealengine.com/u/DevChagrins)\
**Post date:** [August 25, 2023, 6:03pm UTC](https://forums.unrealengine.com/t/packing-for-android-in-5-3-targets-gradle-7-4-2-but-pulls-7-5/1266827/5 "2023-08-25T18:03:51Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![I.PUBG.I](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@I.PUBG.I](https://forums.unrealengine.com/u/I.PUBG.I)\
**Post date:** [August 25, 2023, 6:05pm UTC](https://forums.unrealengine.com/t/packing-for-android-in-5-3-targets-gradle-7-4-2-but-pulls-7-5/1266827/6 "2023-08-25T18:05:31Z")

</div>

it worked for me the same setup as ue5.2. i changed nothing but jdk to 17

---

<div class="post-metadata">

**Author:** ![DevChagrins](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@DevChagrins](https://forums.unrealengine.com/u/DevChagrins)\
**Post date:** [August 25, 2023, 6:09pm UTC](https://forums.unrealengine.com/t/packing-for-android-in-5-3-targets-gradle-7-4-2-but-pulls-7-5/1266827/7 "2023-08-25T18:09:36Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![I.PUBG.I](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@I.PUBG.I](https://forums.unrealengine.com/u/I.PUBG.I)\
**Post date:** [August 25, 2023, 6:10pm UTC](https://forums.unrealengine.com/t/packing-for-android-in-5-3-targets-gradle-7-4-2-but-pulls-7-5/1266827/8 "2023-08-25T18:10:55Z")

</div>

if you change between ue5 and ue4 then yeah your case might be diff than mine. i just changed jdk to 17 and it worked fine

---

<div class="post-metadata">

**Author:** ![k23jm](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@k23jm](https://forums.unrealengine.com/u/k23jm)\
**Post date:** [August 28, 2023, 1:46am UTC](https://forums.unrealengine.com/t/packing-for-android-in-5-3-targets-gradle-7-4-2-but-pulls-7-5/1266827/9 "2023-08-28T01:46:13Z")

</div>

Changing the JDK to 17 worked for me (UE\_5.3).

Followed all steps on the documentation. After that I get the “Could not resolve com.android.tools.build:gradle:7.4.2” error.

> **[Setting Up Android SDK and NDK](https://docs.unrealengine.com/5.2/en-US/how-to-set-up-android-sdk-and-ndk-for-your-unreal-engine-development-environment/)**
>
> How to set up your Android development environment for Unreal Engine

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

> **[Java Archive Downloads - Java SE 17](https://www.oracle.com/java/technologies/javase/jdk17-archive-downloads.html)**
>
> Java Archive Downloads - Java SE 17

Changed the JAVA\_HOME environment variable to the install location of the JDK17  
(mine was "C:\Program Files\Java\jdk-17")

Run the SetupAndroid.bat

Now I can package Android normally.

---

<div class="post-metadata">

**Author:** ![D\_Deng](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/d_deng/32/758117_2.png) [@D\_Deng](https://forums.unrealengine.com/u/D_Deng)\
**Post date:** [September 10, 2023, 6:17am UTC](https://forums.unrealengine.com/t/packing-for-android-in-5-3-targets-gradle-7-4-2-but-pulls-7-5/1266827/10 "2023-09-10T06:17:43Z")

</div>

This helps explain the issue: [How to Set Up Android SDK and NDK For Your Unreal Engine Development Environment | Unreal Engine 5.3 Documentation](https://docs.unrealengine.com/5.3/en-US/how-to-set-up-android-sdk-and-ndk-for-your-unreal-engine-development-environment/)

---

<div class="post-metadata">

**Author:** ![PostNoctem](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@PostNoctem](https://forums.unrealengine.com/u/PostNoctem)\
**Post date:** [September 23, 2023, 7:27pm UTC](https://forums.unrealengine.com/t/packing-for-android-in-5-3-targets-gradle-7-4-2-but-pulls-7-5/1266827/11 "2023-09-23T19:27:52Z")

</div>

I have the same issue in UE5.3.  
I tryed the documentation from UE about 5.3 [setup here](https://docs.unrealengine.com/5.3/en-US/how-to-set-up-android-sdk-and-ndk-for-your-unreal-engine-development-environment/)  
And I tryed to use my 5.2 setup (wich was working)with java home edited to java jdk17 but the error is still there.  
Could someone share their working setup in project settings like this one ? and maybe their environment variables in link with unreal (Java-home and cie).

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/0/c/b0c3d17847f0048f3796ae781bfe95ec65cead8c.png)

I think my issue is from the different versions I have with java JDK/SDK/NDK/gradle/whatever.

---

<div class="post-metadata">

**Author:** ![D\_Deng](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/d_deng/32/758117_2.png) [@D\_Deng](https://forums.unrealengine.com/u/D_Deng)\
**Post date:** [October 2, 2023, 4:50am UTC](https://forums.unrealengine.com/t/packing-for-android-in-5-3-targets-gradle-7-4-2-but-pulls-7-5/1266827/12 "2023-10-02T04:50:21Z")

</div>

It seems you haven’t updated and linked the new JAVA location. The new one should start with ‘jbr’ instead of ‘jdk’ according to the documentation

---

<div class="post-metadata">

**Author:** ![Swanijam](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Swanijam](https://forums.unrealengine.com/u/Swanijam)\
**Post date:** [October 6, 2023, 1:20am UTC](https://forums.unrealengine.com/t/packing-for-android-in-5-3-targets-gradle-7-4-2-but-pulls-7-5/1266827/13 "2023-10-06T01:20:43Z")

</div>

oh and i almost forgot - the environment variables for NDKROOT _must_ match the NDK location in your project settings.  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/d/2/5d26dc43c2fe7d48bc913d3e7197afd1d05f9be1.png)

i think SetupAndroid.bat may have actually determined this NDK version for me and overwritten the env variables, so i ended up copying the path from here and then pasting that into unreal. (I’m not certain but don’t want to undo any part of my working setup at this time)

---

<div class="post-metadata">

**Author:** ![Swanijam](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Swanijam](https://forums.unrealengine.com/u/Swanijam)\
**Post date:** [October 6, 2023, 1:20am UTC](https://forums.unrealengine.com/t/packing-for-android-in-5-3-targets-gradle-7-4-2-but-pulls-7-5/1266827/14 "2023-10-06T01:20:46Z")

</div>

Here are my settings that solved this issue in case anyone wants to try mine. I was building for Oculus Quest Pro in Unreal 5.3.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/9/2/7922c7baf90c44e7de2c4800022e4096a608e76c.png)  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/b/7/9b7cec952d99ec462bae1f27fcfc9991c04eb5fa.png)

---

<div class="post-metadata">

**Author:** ![PRESSURE2000](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@PRESSURE2000](https://forums.unrealengine.com/u/PRESSURE2000)\
**Post date:** [October 23, 2023, 12:53am UTC](https://forums.unrealengine.com/t/packing-for-android-in-5-3-targets-gradle-7-4-2-but-pulls-7-5/1266827/15 "2023-10-23T00:53:23Z")

</div>

what if we want to target the newest 34 ? Why does it only work with 29???

---

<div class="post-metadata">

**Author:** ![ser.man94](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ser.man94](https://forums.unrealengine.com/u/ser.man94)\
**Post date:** [October 25, 2023, 1:58pm UTC](https://forums.unrealengine.com/t/packing-for-android-in-5-3-targets-gradle-7-4-2-but-pulls-7-5/1266827/16 "2023-10-25T13:58:38Z")

</div>

Hi. What versionof JAVA you use?

---

<div class="post-metadata">

**Author:** ![Raed\_Abbas](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/raed_abbas/32/482168_2.png) [@Raed\_Abbas](https://forums.unrealengine.com/u/Raed_Abbas)\
**Post date:** [November 9, 2023, 6:00pm UTC](https://forums.unrealengine.com/t/packing-for-android-in-5-3-targets-gradle-7-4-2-but-pulls-7-5/1266827/17 "2023-11-09T18:00:41Z")

</div>

Thank you for sharing. hmm interesting… I don’t have a jbr folder 🙄

---

<div class="post-metadata">

**Author:** ![Starkium](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/starkium/32/1194588_2.png) [@Starkium](https://forums.unrealengine.com/u/Starkium)\
**Post date:** [November 12, 2023, 3:51am UTC](https://forums.unrealengine.com/t/packing-for-android-in-5-3-targets-gradle-7-4-2-but-pulls-7-5/1266827/18 "2023-11-12T03:51:10Z")

</div>

is this still working for you? Are you on the Meta Source Engine version of 5.3?

---

<div class="post-metadata">

**Author:** ![Blacksilence89](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Blacksilence89](https://forums.unrealengine.com/u/Blacksilence89)\
**Post date:** [November 29, 2023, 5:26pm UTC](https://forums.unrealengine.com/t/packing-for-android-in-5-3-targets-gradle-7-4-2-but-pulls-7-5/1266827/19 "2023-11-29T17:26:43Z")

</div>

a quick solution for me was this:

1. download jdk 17 here: [Java Archive Downloads - Java SE 17](https://www.oracle.com/java/technologies/javase/jdk17-archive-downloads.html) (the zip format is ok)
2. extract the zip file and rename the folder to “jre”
3. go in Android studio installation folder where is most probably supposed you have the current jre (it should be: C:\Program Files\Android\Android Studio) and rename the “jre” folder you currently have to “jre-old” (useful if you need to roll back)
4. cut and paste the ‘jre’ folder you have from step 2 in Android Studio folder
5. try to package again

It worked for me.

---

<div class="post-metadata">

**Author:** ![system](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/1/3/713c9d3f58553f0de89543d76a8a3a2779dc9fa4.png) [@system](https://forums.unrealengine.com/u/system)\
**Post date:** [December 29, 2023, 5:26pm UTC](https://forums.unrealengine.com/t/packing-for-android-in-5-3-targets-gradle-7-4-2-but-pulls-7-5/1266827/20 "2023-12-29T17:26:55Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
