Android Packaging isn't working because of Gradle

I tried EVERYTHING after searching for hours and eventually I found a fix for me…

•Exit the engine entirely and close out anything that might be using gradle.
•Go to “C:\Users*USERNAME*.gradle” and delete the “cache” folder. Or rename it “cacheBACKUP” or something to be cautious.

Worked like a charm for me.

1 Like

Also having issues packaging. Extract of log below

[2020.01.16-06.36.26:215][550]UATHelper: Packaging (Android (ASTC)): :downloader_library:generateDebugSources UP-TO-DATE
[2020.01.16-06.36.26:215][550]UATHelper: Packaging (Android (ASTC)): :downloader_library:javaPreCompileDebug UP-TO-DATE
[2020.01.16-06.36.26:552][551]UATHelper: Packaging (Android (ASTC)): :downloader_library:compileDebugJavaWithJavac FAILED
[2020.01.16-06.36.26:552][551]UATHelper: Packaging (Android (ASTC)): FAILURE: Build failed with an exception.
[2020.01.16-06.36.26:552][551]UATHelper: Packaging (Android (ASTC)): * What went wrong:
[2020.01.16-06.36.26:552][551]UATHelper: Packaging (Android (ASTC)): Execution failed for task ‘:downloader_library:compileDebugJavaWithJavac’.
[2020.01.16-06.36.26:552][551]UATHelper: Packaging (Android (ASTC)): > Could not find tools.jar. Please check that C:\Program Files\Java\jre1.8.0_231 contains a valid JDK installation.
[2020.01.16-06.36.26:552][551]UATHelper: Packaging (Android (ASTC)): * Try:
[2020.01.16-06.36.26:552][551]UATHelper: Packaging (Android (ASTC)): 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.
[2020.01.16-06.36.26:552][551]UATHelper: Packaging (Android (ASTC)): * Get more help at https://help.gradle.org
[2020.01.16-06.36.26:552][551]UATHelper: Packaging (Android (ASTC)): BUILD FAILED in 21s
[2020.01.16-06.36.26:552][551]UATHelper: Packaging (Android (ASTC)): 30 actionable tasks: 3 executed, 27 up-to-date
[2020.01.16-06.36.27:218][552]UATHelper: Packaging (Android (ASTC)): ERROR: cmd.exe failed with args /c “C:\Users\Dino\Documents\Unreal Projects\DEBCalProject\Intermediate\Android\APK\gradle\rungradle.bat” :app:assembleDebug
[2020.01.16-06.36.27:218][552]UATHelper: Packaging (Android (ASTC)): (see C:\Users\Dino\AppData\Roaming\Unreal Engine\AutomationTool\Logs\C+Program+Files+Epic+Games+UE_4.24\Log.txt for full exception trace)
[2020.01.16-06.36.27:218][552]UATHelper: Packaging (Android (ASTC)): AutomationTool exiting with ExitCode=1 (Error_Unknown)
[2020.01.16-06.36.27:218][552]UATHelper: Packaging (Android (ASTC)): BUILD FAILED
[2020.01.16-06.36.27:218][552]PackagingResults: Error: Unknown Error
[2020.01.16-06.37.48:889][909]LogSlate: Took 0.013221 seconds to synchronously load lazily loaded font ‘…/…/…/Engine/Content/Slate/Fonts/DroidSansMono.ttf’ (77K)

It fails at “:downloader_library:compileDebugJavaWithJavac FAILED” apparently because it cannot find tools.jar, which sure enough does not exist anywhere on my PC. Best I can tell I have jre1.8.0_231 installed. So why does it not contain tool.jar? or how can I get tools.jar?

I have gone to Android Codeworks chooser.exe and have updated what I could. I have a problem with the NVidia Tegra installation though, it keeps complaining that no Visual Studio is installed (even though it is) and stops the installation. From what I read, UnReal prefers VS 2015 (I cannot find it online) but does work with VS2019, which I have installed.

I am currently updating Android SDK via the android.bat command mentioned by Mint Gorillaz.

Any assistance is welcome.

P.S. → just cannot understand why devs don’t simplify installation processes. It’s rather frustrating to waste so much time just getting everything setup. I fiddled with UnReal now for 5 years and have very little to show for it. It took me 3 months to self-learn Unity and produce an end product.

Hello! I need your help. I faced the same problem. all of the above did not help me.
сhooser.exe does not update anything. and android.bat doesn’t update anything. I indicated the path to the SDK and NDK in the engine. I accepted the license. but still getting this error.
please help me. I’m desperate

no matter how many times i click on it and accept it… it does not take. i never grays out or accepts my ‘accept’ click. suggestions? using 4.24.

on your pics, the area you circled, where did you find the info to put there? i’ve had to create so many different google pages for different keys and such that i am unsure where this info would be located? this is my first time setting this up. i cannot get the accept SDK license to actually ‘accept’ so i am hoping this solves the issue if i can find where to locate the info to put there…

i have tried all the suggestions here, and i still can’t get the keystore key to run. it tells me keytool is invalid. i updated the java pack, added paths to everywhere, the stuff is all in the right places and i keep getting the error. i cannot move forward until i get this sorted out and am at a loss as to what to try next.

i am an android developer. So just a small doubt. How to get gradle in unreal engine? I want to add firebase to project in unreal engine? How to do that?

I am also getting the same problem in unreal 4,25.1

Hey ! Iam using 4.26 and it requires android studio and vs community 2019. i have same problem yesterday. 3 times i make my project from beginning again and again. but finally i know that makes UE4 gradle error. the visual studio and android studio did auto update. so what i did is :

  1. deleteing Intermediate Folder
  2. deleting Saved Folder
  3. [Important] Deleteing Binaries Folder

and last. rebuild project.
and it works HAHA i dont need to make a project from beginning and recode it again.

hope it will help :slight_smile: thanks !

That worked for me too. Thank you!

Watch this video, It will explain.

this will only work with older versions not the latest version which I am using and none of the above worked for me.

did you solve it??

None of it work for me. Here what i done so far and failed.

  1. Delete saved folder, intermediate folder, binaries folder, rebuild.

  2. Delete gradle cache folder.

  3. Switch to another sdk, ndk version in android studio

  4. Download all version of sdk, ndk in android studio. And set unreal project to use latest.

  5. Download java jdk. Latest version. Set unreal jdk path to that jave jdk.

  6. Download NVpack, but i cant see update module anywhere.

  7. Set sdk path, ndk path of unreal project to
    sdk, ndk of NVpack

8.run gradle.bat manually

  1. Turn off firewall, set firewall to allow andoird studio connect internet.

All of it failed. Somebody help me

does it got solve ? i am same as you and its so frustrating nothing is working