Getting NoSuchMethodError exception on com.android.prefs.AndroidLocation.getAvdFolder() when trying to run “ionic cordova run --emulator”

纵然是瞬间 提交于 2019-12-04 04:27:35

问题


I just upgraded my cordova and ionic (npm upgrade -g cordova ionic) and now when I run "ionic cordova run --emulator" I'm getting the following error message:

Exception in thread "main" java.lang.NoSuchMethodError: com.android.prefs.AndroidLocation.getAvdFolder()Ljava/lang/String;

The build is successful, it just doesn't seem to want to start the emulator.

Any help would be very appreciated.


Here is the end of the log after the successful build message:

BUILD SUCCESSFUL

Total time: 5.135 secs Built the following apk(s): /Users/lesbuchanan/source/personal/sandbox/mobile/ionic/phone-vow/platforms/android/build/outputs/apk/android-debug.apk

ANDROID_HOME=/Users/lesbuchanan/Library/Android/sdk/ JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_112.jdk/Contents/Home Error: avdmanager: Command failed with exit code 1 Error output: Exception in thread "main" java.lang.NoSuchMethodError: com.android.prefs.AndroidLocation.getAvdFolder()Ljava/lang/String; at com.android.sdklib.internal.avd.AvdManager.getInstance(AvdManager.java:380) at com.android.sdklib.tool.AvdManagerCli.getAvdManager(AvdManagerCli.java:338) at com.android.sdklib.tool.AvdManagerCli.displayAvdList(AvdManagerCli.java:516) at com.android.sdklib.tool.AvdManagerCli.doAction(AvdManagerCli.java:355) at com.android.sdklib.tool.AvdManagerCli.run(AvdManagerCli.java:203) at com.android.sdklib.tool.AvdManagerCli.main(AvdManagerCli.java:193)

[ERROR] Cordova encountered an error. You may get more insight by running the Cordova command above directly.

[ERROR] An error occurred while running cordova run android --emulator (exit code 1).enter code here


回答1:


As it turns out, I just used Android Studio to update the SDK tools. Go to Preferences -> Appearance & Behavior -> System Settings -> Android SDK, then click the SDK Tools tab. I updated the following packages:

  • Android SDK Build-Tools
  • Android Emulator
  • Android SDK Platform-Tools
  • Android SDK Tools
  • Intel x86 Emulator Accelerator
  • Support Repository->Android Support Repository
  • Support Repository->Google Repository

I'm honestly not sure which package solved my problem but I imagine updating all of them at the same time was a good idea. Hope this helps someone.



来源:https://stackoverflow.com/questions/43949191/getting-nosuchmethoderror-exception-on-com-android-prefs-androidlocation-getavdf

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!