Welcome to ZaiNaLe Developer Community-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
2.5k views
in Technique[技术] by (71.8m points)

cordova - Error while getting native targets for android: No valid Android SDK root found

I'm trying to run the command:

ionic cordova run android

and this error always appears:

[ERROR] Error while getting native targets for android: No valid Android SDK root found.

This error occurred while using native-run. You can try running this command with --no-native-run, which will revert to using Cordova.

Environment:

Ionic:

   Ionic CLI                     : 6.12.3 (/usr/local/lib/node_modules/@ionic/cli)
   Ionic Framework               : @ionic/angular 4.0.1
   @angular-devkit/build-angular : 0.8.9
   @angular-devkit/schematics    : 0.8.9
   @angular/cli                  : 7.3.8
   @ionic/angular-toolkit        : 1.3.0

Cordova:

   Cordova CLI       : 7.1.0
   Cordova Platforms : android 9.0.0
   Cordova Plugins   : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 2.3.3, (and 13 other plugins)

Utility:

   cordova-res : 0.15.2
   native-run  : 1.3.0

System:

   NodeJS : v14.15.4 (/usr/local/bin/node)
   npm    : 2.15.12
   OS     : Linux 4.15

~/.bashrc:

export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
export ANDROID_HOME="~/Android/Sdk"
export ANDROID_SDK_ROOT="~/Android/Sdk"

export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
export PATH=$PATH:$ANDROID_SDK_ROOT/tools/bin
export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools
export PATH=$PATH:$ANDROID_SDK_ROOT/emulator

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神解答

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to ZaiNaLe Developer Community-Open, Learning and Share
...