B. Mc
B. Mc

Reputation: 11

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

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:

JAVA_HOME is set to an invalid directory 01

JAVA_HOME is set to an invalid directory 02

When I try to build I get the same error plus some additional errors:

Console error printouts

Failed to update Android SDK

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:

External SDK Tools settings

Possibly relevant information:

Java JDK 14.0.1

Upvotes: 1

Views: 1742

Answers (1)

Horothenic
Horothenic

Reputation: 678

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.

Upvotes: 1

Related Questions