JDK, SDK, and Gradle errors trying to build a Unity game for Android - unity3d

The question:
My environmental variable JAVA_HOME is set to the location of my manual installation of Java, so why is Unity claiming it is an invalid directory?
Supporting information:
I'm using Unity to build a game for Android phones with the intent on putting it on the Google Play Store for a client. We need to use a Google Ad plugin for managing ads in the game. However, when I put the plugin into the project I can no longer build the game.
When going to Assets > External Dependency Manager > Android Resolver > Resolve, it claims it succeeds.
But when I try Assets > External Dependency Manager > Android Resolver > Force Resolve or even building the project I get a failure and a perplexing error.
Originally I had the same problem as: Intellij Gradle terminal ERROR: JAVA_HOME is not set
When I tried the solutions there as well as following the steps at: https://javatutorial.net/set-java-home-windows-10
I've tried setting the environment variable both to the independent java installation as well as the location of Unity's JDK module and got an error that they were both invalid directories:
When I try to build I get the same error plus some additional errors:
I am unsure if the SDK error is related or not.
I already tried toggling these off and on, and even changing the installation targets to manual installations:
Possibly relevant information:
Using Unity 2019.3.0f6
InMobi Google Ads Unity Mediation Plugin Version 3.0.0
Windows 10 Pro
Java JDK 14.0.1

If Unity can't find JAVA_HOME it won't do anything, have you tried checking if you have that Environment Variable set correctly?
Check this thing.
Maybe you will need a Restart on you computer to see the changes.

Related

What should I do if the tool package fails to run when I integrate the HUAWEI AppGallery Connect SDK to Eclipse?

I had recently planned on integrating the Crash SDK to my app. However, my app was developed through Eclipse and the integration process was different from that in Android Studio.
By referring to the official materials, I downloaded the tool package and used it to generate an Eclipse project package.
However, when the build.bat file in the aar2eclipse/aar directory was executed according to the procedures in the document, an error was reported in the command line. The error information was as follows:
FAILURE: Build failed with an exception.
What went wrong:
Task ' assembleRelease ' not found in root project ' aar '.
[![enter image description here][1]][1]
I first thought that the problem might be caused by my company's intranet. But when I connected to the Internet, the problem remained unsolved.
Then I guessed that it might have something to do with the Android development environment.
I borrowed a colleague's PC to execute the build.bat file, and it that did the trick. Therefore, I was able to conclude that the problem was caused by incorrect configurations in the Android development environment. I compared the configurations on the two PCs and found that the environment variables were different. ANDROID_HOME was missing from the environment variables on my PC.
Cause
Huawei's Eclipse tool package is unable to run properly and reports an error without the ANDROID_HOME variable.
Solution: Right-click This PC and choose Properties from the shortcut menu. In the displayed dialog box, click the Advanced System Settings tab and then click Environment Variables. In the System Variables dialog box, create a new ANDROID_HOME parameter.
Set the value to the installation path of the local Android SDK, and the problem will be resolved, as shown below.
Reference:
https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-Guides/agc-get-started#h2-1587519820720

IL2CPP does not work due to NDK (Unity 2019.2.0f1)

I desperately need to build 64-bit of my application since Google Play does not accept 32-bit apps anymore. Mono builds just fine but when I switch to IL2CPP it says it can't locate NDK. However, NDK is automatically installed via **Unity Hub.**
I saw similar posts regarding to NDK in previous versions of Unity but I thought this would be fixed by now with latest Unity version. I have also tried to use a different NDK but I was still getting the same error.
Please help....
Check the Preferences dialog in the Unity Editor. It should have an option to provide a path to the Android NDK directory. There you can manually enter the path to the proper NDK installation location.
Well actually this turned to be related to MacOS version. On my other Mac, which is newer, the same Unity version detects NDK just fine.
The reason is that the NDK path being set automatically by Unity is wrong:
Unselect 'android NDK installed with Unity' in Unity Preferences. It will show the NDK Path. At the end of the path, you need to add:
/android-ndk-r16b
Check here for more details:
https://stackoverflow.com/questions...nable-to-locate-android-ndk/58241817#58241817

Unable to list target platforms Unity 2018.1.0f2

I have a problem when i build / export my game into android's APK.
i've already replace latest tools folder to my SDK path but the problem still don't fixed.
So i tried to upgrade my Unity from 2017.2.0f3 into Unity 2018.1.0f2 and reconfigure my SDK path but still not working.
There's the error notice
Go through Unitys preferences and make sure android SDK Java SDK paths are configured. I had this error recently on a fresh install, the solution was to install https://developer.android.com/studio/releases/platform-tools ( also setting paths to platform tools in your system path can be useful while at it)

Unity "Unable to find the Android SDK manager tool" (path already set) [duplicate]

This question already has an answer here:
Unable to list target platforms. Please make sure the android sdk path is correct
(1 answer)
Closed 4 years ago.
If I start my Unity Project I get this message:
Unable to find the Android SDK manager tool. Required Android packages (extra-google-m2repository) can not be installed. Android SDK path not set. Set the Android SDK property using the Unity "Edit > Preferences > External Tools" menu option on Windows or the "Unity > Preferences > External Tools" menu option on OSX. Alternatively, set the ANDROID_HOME environment variable
UnityEngine.Debug:LogError(Object)
GooglePlayServices.ResolverVer1_1:DoResolution(PlayServicesSupport, String, OverwriteConfirmation, Action)
GooglePlayServices.PlayServicesResolver:Resolve(Action)
GooglePlayServices.PlayServicesResolver:AutoResolve()
UnityEditor.EditorApplication:Internal_CallUpdateFunctions()
But I installed the complete sdk and also set the path via Preferences. What Im doing wrong?
My sdk is in the same folder as UNITY.
just check if the android sdk folder was configured correctly in Edit->Preference->External Tools
I had almost the same issue. It all started to when i tried to install a unitypackage which includes a GooglePlayServiceResolver. And only happened in one project, while other projects don't complain about 'missing sdk'.
I had it solved by not using the GooglePlayServicesResolver included by the unitypackage.
This is what i did :
1. Remove all files that was installed by the package, including the resolver.
2. Download and install latest resolver.
3. Re-import the package, but this time without the resolver since i already had the latest.
My resolver ran automatically and resolved dependencies without complaining about missing Android SDK anymore.

Invalid or corrupt jarfile android.jar issue

I am trying to build and run an android project using the phonegap framework.
I have configured the IDE and followed the steps described in an official tutorial (see link above).
The problem is that I never had a chance to build the project since it contains errors. The major one is (see screenshots):
Archive for required library: 'C:/Program Files/Android/android-sdk/platforms/android-8/android.jar' in project 'xxx' cannot be read or is not a valid ZIP file
Also, I have tried to manually run the aforementioned android.jar but got the same error:
The problem keeps reproducing through several SDK versions: r14, r15.
BTW, I experience no troubles building a project using other android versions, e.g., 2.3.
Would someone help me out? Thanks!
Use the Android package manager to remove and then re-download the Android 2.2 SDK as something is corrupt with that package.