3

I'm getting this error when I try to build an app for Android. I have tried various suggestions on the web such as installing JDK8 instead of JDK9, and installing an older version of the tools, but none of them work.

Can someone help me, please? I really need to build a release. The error is as follows:


CommandInvokationFailure: Unable to list target platforms. Please make sure the android sdk path is correct.

C:\Users\x\AppData\Local\Android\Sdk\tools\bin\avdmanager.bat list target -c

stderr[
Exception in thread "main" java.lang.NoSuchMethodError:  com.android.prefs.AndroidLocation.getAvdFolder()Ljava/lang/String;
at com.android.sdklib.tool.AvdManagerCli.init(AvdManagerCli.java:278)
at com.android.sdklib.tool.AvdManagerCli.run(AvdManagerCli.java:210)
at com.android.sdklib.tool.AvdManagerCli.main(AvdManagerCli.java:200)
]
stdout[
]
exit code: 1
UnityEditor.Android.PostProcessor.CancelPostProcess.AbortBuild
(System.String title, System.String
message, System.Exception ex) (at
<388bfc6933e8438da93bcd874bbbeee6>:0)
UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks
(UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <388bfc6933e8438da93bcd874bbbeee6>:0)
UnityEditor.Android.PostProcessAndroidPlayer.PrepareForBuild
(UnityEditor.BuildOptions options,
UnityEditor.BuildTarget target) (at <388bfc6933e8438da93bcd874bbbeee6>:0)
UnityEditor.Android.AndroidBuildPostprocessor.PrepareForBuild
(UnityEditor.BuildOptions options,
UnityEditor.BuildTarget target) (at <388bfc6933e8438da93bcd874bbbeee6>:0)
UnityEditor.PostprocessBuildPlayer.PrepareForBuild
(UnityEditor.BuildOptions options,
UnityEditor.BuildTargetGroup
targetGroup, UnityEditor.BuildTarget
target) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs:87)
UnityEditor.BuildPlayerWindow:BuildPlayerAndRun()
Peter Morris
  • 20,174
  • 9
  • 81
  • 146
  • is your android sdk up to date? – hardartcore Mar 10 '18 at 20:10
  • This problem seems to happen every major Unity update. Try the instruction from [this](https://stackoverflow.com/questions/37313735/unable-to-list-target-platforms-please-make-sure-the-android-sdk-path-is-correc/37314122#37314122) answer and see i that solves the issue – Programmer Mar 10 '18 at 20:58
  • @Peter Morris Did you solve it? I tried everything, no dice. Strangely enough if I manually execute the avdmanager line that Unity complaints about it works :( – German Mar 19 '18 at 15:45
  • I copied my sdk folder from a working computer. It's 1GB, would you like a download url? – Peter Morris Mar 19 '18 at 21:02

1 Answers1

0

I downloaded the latest version of Unity3D (2017.4.0f1) and re-installed Android tools, then I ensured all Android APIs were installed as far back as Lollipop, and then it worked again.

Peter Morris
  • 20,174
  • 9
  • 81
  • 146