[Android] java.lang.NoSuchMethodError: com.android.prefs.AndroidLocation.getAvdFolder()

Hi,

we are now getting the following error: java.lang.NoSuchMethodError: com.android.prefs.AndroidLocation.getAvdFolder()

It seems like the SK wouldn’t be installed correctly or something?

Here is the log around the error:

9498: [Unity] UnityEditor.CloudBuild.Builder:Build()
9499: [Unity] CommandInvokationFailure: Unable to list target platforms. Please make sure the android sdk path is correct. See the Console for more details.
9500: [Unity] /APPLICATION_PATH/Android Studio.app/sdk/tools/bin/avdmanager list target -c
9501: [Unity] stderr[
9502: [Unity] Exception in thread "main" java.lang.NoSuchMethodError: com.android.prefs.AndroidLocation.getAvdFolder()Ljava/lang/String;
9503: [Unity] ]
9504: [Unity] stdout[
9505: [Unity] ]
9506: [Unity] exit code: 1
9507: [Unity]   at UnityEditor.Android.Command.WaitForProgramToRun (UnityEditor.Utils.Program p, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) [0x00000] in <filename unknown>:0
9508: [Unity]   at UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) [0x00000] in <filename unknown>:0
9509: [Unity]   at UnityEditor.Android.AndroidSDKTools.RunAndroidSdkTool (System.String toolName, System.String arguments, Boolean updateCommand, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) [0x00000] in <filename unknown>:0
9510: [Unity]   at UnityEditor.Android.AndroidSDKTools.ListTargetPlatforms (UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit) [0x00000] in <filename unknown>:0
9511: [Unity]   at UnityEditor.Android.AndroidSDKTools.GetTopAndroidPlatformAvailable (UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit) [0x00000] in <filename unknown>:0
9512: [Unity]   at UnityEditor.Android.PostProcessor.Tasks.CheckAndroidSdk+SDKPlatformDetector.GetVersion (UnityEditor.Android.AndroidSDKTools sdkTools) [0x00000] in <filename unknown>:0
9513: [Unity]   at UnityEditor.Android.PostProcessor.Tasks.CheckAndroidSdk+SDKComponentDetector.Detect (UnityEditor.Android.AndroidSDKTools sdkTools, System.Version minVersion, UnityEditor.Android.PostProcessor.ProgressHandler onProgress) [0x00000] in <filename unknown>:0
9514: [Unity]   at UnityEditor.Android.PostProcessor.Tasks.CheckAndroidSdk.EnsureSDKComponentVersion (System.Version minVersion, UnityEditor.Android.PostProcessor.Tasks.SDKComponentDetector detector) [0x00000] in <filename unknown>:0
9515: [Unity]   at UnityEditor.Android.PostProcessor.Tasks.CheckAndroidSdk.EnsureSDKComponentVersion (Int32 minVersion, UnityEditor.Android.PostProcessor.Tasks.SDKComponentDetector detector) [0x00000] in <filename unknown>:0
9516: [Unity]   at UnityEditor.Android.PostProcessor.Tasks.CheckAndroidSdk.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context) [0x00000] in <filename unknown>:0
9517: [Unity]   at UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) [0x00000] in <filename unknown>:0
9518: [Unity] UnityEditor.BuildPipeline:BuildPlayerInternalNoCheck(String[], String, String, BuildTargetGroup, BuildTarget, BuildOptions, Boolean)
9519: [Unity] UnityEditor.CloudBuild.Builder:Build()

Best regards

See the reply here: Getting NoSuchMethodError exception on com.android.prefs.AndroidLocation.getAvdFolder() when trying to run "ionic cordova run --emulator" - Stack Overflow

Thanks for you reply! But it is hard for me do update the SDK on the cloud build servers :wink:

As additional information: This started when switching from 2017.1.2 to 2017.2p2. Local build runs fine.

Just found this bug report: Unity Issue Tracker - Android Build fails when the latest Android SDK Tools 25.3.1 version is used
Describes the problem quite good - however doesn’t speak about UCB and also is said to be fixed since 2017.1. Maybe a regression?

Same issue with 2017.2.0p2, going back to p1 fix it

That issue you linked to should’ve been already fixed… not sure if its back or whats the current status…

I’m glad to see I’m not the only one having this error, I’m observing the same on our Cloud Build Agent running Unity 2017.2.0p2.
Unfortunately, we can’t go back to p1 since p2 is fixing important bugs for us.

I guess we don’t have other choice but waiting for a bug fix from Unity.

We are experiencing this issue in UCB as well, running 2017.2.0p2. UCB works for the same project on 2017.2.0p1.

Local builds are fine in 2017.2.0p2.

Bump

Running into this as well with cloud build on 2017.2.0p2

We’re trying to build against Android SDK 21, and it’s a problem because:

  • 2017.2.0f3 fails to build with Android SDKs 21-23 (presumably bug #956658 ?)
  • 2017.2.0p2 fixes that build bug, but fails on UCB with the “can’t list target platforms” error

Oh cool. So I’m not going insane. Rolling back to p1 for now…

Has anyone raised a bug?

Yep, they’re working on it. Hopefully fixed in the next few days.
Seems to be a build tools update issue.

Bump,
the issue still remains when trying to build for Android platform on UCB 2017.2.0p3.

For god’s sake. When Unity allow us to build for Android without having to downgrade?
This is just irresponsible and ridiculous.

2 Likes

Same problem here!

1 Like