Unity: Android build errors compilation
Updated: Jan 16
For all my games, I use:
MoPob mediation to monetize.
Unity Easy Mobile Pro asset to integrate MoPub ADs/mediation and to implement other generic features like app rating etc,.
For reference I am using Unity 2019.4.17f1.
Time to time I see few errors while building for Android. So, in this bog post I am compiling fixes for my future reference and to help for other devs who face these.
No Java runtime present, requesting install.
After you install Unity for the first time, some times it throws this error.
From https://github.com/firebase/quickstart-unity/issues/849 post: "So first, I know this sounds really odd, but I've seen issues in MacOS in the past that are resolved simply by toggling the "JDK Installed with Unity" button. As in on or off doesn't matter, just that it changes. Try unchecking that and hitting build (without restarting Unity). If that works, that is one bug to start tracking and can help you get unstuck."
I tried toggle & untoggle couple of times and it fixed No Java runtime present, requesting install. issue.
Error: unexpected element <queries> found in <manifest>
To fix this use gradle version that included queries in it, which seems to be above 3.4.3. So use this
Error while merging dex archives: The number of method references in a .dex file cannot exceed 64K.
To fix this enable multidex via launcherTemplate.gradle
Your Android setup is not correct. See Settings in Facebook menu.
Just uncheck recommended Android SDK from Unity preferences and browse Android SDK to the exact same one Unity already using will fix this issue.
You uploaded a debuggable APK or Android App Bundle.
Sometimes when I upload android build that is built with Unity throws this error: You uploaded a debuggable APK or Android App Bundle. For security reasons you need to disable debugging before it can be published in Google Play. Learn more about debuggable APKs and Android App Bundles.
If you are using FacebookSDK which comes with Google Play services, it can be that in injects a Debuggable=true key in the Manifest, for whatever reason.
you can fix it by going to Assets -> Android -> AndroidManifest.xml
In there find 'android:debuggable="true"' and set it to false.
Google Play Console Error: This release is not compliant with the Google Play 64-bit requirement.
To fix this Go to Player Settings -> Other Setting -> Under Configuration
Select IL2CPP for Scripting Background.
Now you will see ARM64 under Target Architecture and check it.
Regenerate build and it shouldn't throw above error anymore.