PANIC: Cannot find AVD system path. Please define ANDROID_SDK_ROOT

自作多情 提交于 2019-11-29 02:10:20

问题


I'm trying to run my first Ionic app but i'm getting this error where it does not find my phone and does not find the emulator to run either.

C:\Users\MART\Dropbox\Ionic\myapp>ionic run android
Running command: "C:\Program Files\nodejs\node.exe" C:\Users\MART\Dropbox\Ionic\myapp\hooks\after_prepare\010_add_platform_class.js C:\Users\MART\Dropbox\Ionic\myapp

add to body class: platform-android

ANDROID_HOME=C:\Users\MART\Dropbox\Ionic\adt-bundle-windows-x86_64-20140702\sdk

JAVA_HOME=C:\Program Files\Java\1.8.0_20\jdk1.8.0_20

Subproject Path: CordovaLib

Incremental java compilation is an incubating feature.

:preBuild UP-TO-DATE
:preDebugBuild UP-TO-DATE
:checkDebugManifest
:CordovaLib:preBuild UP-TO-DATE
:CordovaLib:preDebugBuild UP-TO-DATE
:CordovaLib:checkDebugManifest   
:CordovaLib:prepareDebugDependencies
:CordovaLib:compileDebugAidl UP-TO-DATE
:CordovaLib:compileDebugNdk UP-TO-DATE
:CordovaLib:compileLint UP-TO-DATE
:CordovaLib:copyDebugLint UP-TO-DATE
:CordovaLib:mergeDebugShaders UP-TO-DATE
:CordovaLib:compileDebugShaders UP-TO-DATE
:CordovaLib:generateDebugAssets UP-TO-DATE
:CordovaLib:mergeDebugAssets UP-TO-DATE
:CordovaLib:mergeDebugProguardFiles UP-TO-DATE
:CordovaLib:packageDebugRenderscript UP-TO-DATE
:CordovaLib:compileDebugRenderscript UP-TO-DATE
:CordovaLib:generateDebugResValues UP-TO-DATE
:CordovaLib:generateDebugResources UP-TO-DATE
:CordovaLib:packageDebugResources UP-TO-DATE
:CordovaLib:processDebugManifest UP-TO-DATE
:CordovaLib:generateDebugBuildConfig UP-TO-DATE
:CordovaLib:processDebugResources UP-TO-DATE
:CordovaLib:generateDebugSources UP-TO-DATE
:CordovaLib:incrementalDebugJavaCompilationSafeguard UP-TO-DATE
:CordovaLib:compileDebugJavaWithJavac UP-TO-DATE
:CordovaLib:processDebugJavaRes UP-TO-DATE
:CordovaLib:transformResourcesWithMergeJavaResForDebug UP-TO-DATE
:CordovaLib:transformClassesAndResourcesWithSyncLibJarsForDebug UP-TO-DATE
:CordovaLib:mergeDebugJniLibFolders UP-TO-DATE
:CordovaLib:transformNative_libsWithMergeJniLibsForDebug UP-TO-DATE
:CordovaLib:transformNative_libsWithSyncJniLibsForDebug UP-TO-DATE
:CordovaLib:bundleDebug UP-TO-DATE
:prepareAndroidCordovaLibUnspecifiedDebugLibrary UP-TO-DATE
:prepareDebugDependencies
:compileDebugAidl UP-TO-DATE
:compileDebugRenderscript UP-TO-DATE
:generateDebugBuildConfig UP-TO-DATE
:generateDebugResValues UP-TO-DATE
:generateDebugResources UP-TO-DATE 
:mergeDebugResources UP-TO-DATE
:processDebugManifest UP-TO-DATE
:processDebugResources UP-TO-DATE
:generateDebugSources UP-TO-DATE
:incrementalDebugJavaCompilationSafeguard UP-TO-DATE
:compileDebugJavaWithJavac UP-TO-DATE
:compileDebugNdk UP-TO-DATE
:compileDebugSources UP-TO-DATE
:mergeDebugShaders UP-TO-DATE
:compileDebugShaders UP-TO-DATE
:generateDebugAssets UP-TO-DATE
:mergeDebugAssets UP-TO-DATE
:transformClassesWithDexForDebug UP-TO-DATE
:mergeDebugJniLibFolders UP-TO-DATE
:transformNative_libsWithMergeJniLibsForDebug UP-TO-DATE
:processDebugJavaRes UP-TO-DATE
:transformResourcesWithMergeJavaResForDebug UP-TO-DATE
:validateSigningDebug
:packageDebug UP-TO-DATE
:assembleDebug UP-TO-DATE
:cdvBuildDebug UP-TO-DATE    
BUILD SUCCESSFUL
Total time: 4.105 secs

Built the following apk(s):
        C:/Users/MART/Dropbox/Ionic/myapp/platforms/android/build/outputs/apk/android-debug.apk

ANDROID_HOME=C:\Users\MART\Dropbox\Ionic\adt-bundle-windows-x86_64-20140702\sdk

JAVA_HOME=C:\Program Files\Java\1.8.0_20\jdk1.8.0_20

No target specified and no devices found, deploying to emulator


No emulator specified, defaulting to Nexus

Waiting for emulator to start...

PANIC: Cannot
 find AVD system path. Please define ANDROID_SDK_ROOT

...........................................................................

I have this installed in my android manager


回答1:


I have same issue when I run my ionic 2 app on windows (ionic run android), and I solve it by following these steps, hope it will help you.

1- Start your Android Studio.

2- Create a New Project to be able to create or delete virtual devices.

3- Delete any virtual devices if found.

4- and create virtual device via AVD manager as shown below .




回答2:


AVD cant find SDK root, possibly because they are in a different directory.Set your environment variables as shown in below screenshot:




回答3:


I got this error when trying to run it on a Kindle Fire. Enable ADB on the Kindle Fire and via your project: https://developer.amazon.com/docs/fire-tablets/connecting-adb-to-device.html#install-the-usb-driver-windows-users

I used VS code and the built in terminal running the command: ionic cordova run android




回答4:


For me, the issue was a wrong ANDROID_HOME environment variable on mac, I had to use the homebrew version. Added this to the .zshrc:

export ANDROID_HOME=$(brew --prefix)/share/android-sdk



回答5:


I had the same problem and none of the answers here solved my issue, I think the reason in my case was either Ionic framework or and most probably Native Script framework. Native Script uses the Android Studio emulator to link to their mobile apps so they change the Andriod Studio emulator's path. What I did to solve the issue:

1.Unistall Ionic, Cordova, and Native Script - I'm not sure if this step is necessary

2- Uninstall Android Studio and deleting the folder Android in AppData/Local folder

3- Install Andriod Studio and make sure not to import settings

1- Unistall Ionic, Cordova, and Native Script I'm not sure if this step is necessary

For Window system

npm uninstall -g ionic
npm uninstall -g cordova
npm uninstall -g nativescript

2- Uninstall Android Studio

  • Uninstall Android Studio from control panel
  • Delete the folder users/${yourUserName}/appData/Local/Android (Show hidden files to see appData folder)

3- Reinstall Android Studio

  • Make sure not to import settings

After that you might want to install the frameworks again, I did not




回答6:


First try this: If you are using a device. then just ensure that the device is well-connected. Check in the android studio that, the device is online. This error pops up usually when the device is offline.

If it does not work, https://stackoverflow.com/a/39711435/6747251




回答7:


If you are using Xamarin, Go to Tools -> Android -> Restart Adb server.



来源:https://stackoverflow.com/questions/41274830/panic-cannot-find-avd-system-path-please-define-android-sdk-root

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