google-ar / arcore-unity-sdk

ARCore SDK for Unity
https://developers.google.com/ar
Other
1.4k stars 400 forks source link

JDK and Android SDK errors. #587

Open itssmutnuri opened 5 years ago

itssmutnuri commented 5 years ago

SPECIFIC ISSUE ENCOUNTERED

Below error pops up when I "play" a scene with ARCore (HelloAR, in this case), and the console errors (also shown below) when I build it. Checked with a simple Android build, without the ARCore SDK, the error doesn't occur.

error

consoleError

Error: A JDK path needs to be specified for the Android Build

The JDK has been installed using the Unity installer, which is the recommended method:

preferences**

For some reason, ARCore is unable to detect the JDK on its own, when it has been installed via Unity

I'm not sure what I'm missing here. Does ARCore SDK not support the JDK with Unity?

Edit: Given the same settings as before, I am also encountering the below issue, thrown by Instant Preview. The Android SDK is not being detected.

SDK error

VERSIONS USED

STEPS TO REPRODUCE THE ISSUE

  1. Load ARCore unitypackage into empty project
  2. Open HelloAR scene (or any example scene)
  3. Play the scene/build the project.

WORKAROUNDS (IF ANY)

Configuring the JDK/SDK path manually.

vinayak-vc commented 5 years ago

Configuring the JDK/SDK path manually.

miner46er commented 5 years ago

One workaround I found is to uncheck JDK/SDK installed with Unity, click on both browse button so that the path filled automatically and then re-check the checkbox.

itssmutnuri commented 5 years ago

Thank you, @miner46er . That works.

But shouldn't it happen automatically?

On digging around a bit, I found that both the JDK path and Android SDK path are being set via Unity's EditorPrefs:

JDK Path: CloudAnchorPreprocessBuild.cs script (line 52):

var jdkPath = UnityEditor.EditorPrefs.GetString("JdkPath");

SDK Path: ShellHelper.cs script (line 84):

sdkRoot = EditorPrefs.GetString("AndroidSdkRoot");

If I'm guessing right, these are not being correctly referred to. I'm not sure if anything has changed from Unity's end.

miner46er commented 5 years ago

You're welcome, @itssmutnuri.

Yeah, I found that too. Apparently when you tick "JDK/SDK installed with Unity" checkboxes, Unity doesn't automatically set the proper value to JdkPath and AndroidSdkRoot.

victor871129 commented 5 years ago

@xiaomaogy

xiaomaogy commented 5 years ago

Why did I get @ here @victor871129 ?