BDeliers
BDeliers

Reputation: 84

Android target: not installed and plugin installation failed Cordova

I'm having issues with my Cordova installation : I installed cordova, Android Studio, Android SDK, Java and defined
JAVA_HOME="/usr/lib/jdk1.8.0_161/bin/java" ANDROID_HOME="/home/myusername/Android/Sdk/platforms/android-24" In /etc/environment. When I go to a Cordova project and type cordova requirments android, I have the error

Android Studio project detected

Requirements check results for android:
Java JDK: installed 1.8.0
Android SDK: installed true
Android target: not installed
android: Command failed with exit code ENOENT
Gradle: installed /usr/share/gradle/bin/gradle

When I change ANDROID_HOME to /home/myusername/Android/Sdk/, the error becomes

avdmanager: Command failed with exit code 1

I can't find the problem, I didn't found a good answer on the other posts...

Upvotes: 0

Views: 2369

Answers (3)

BDeliers
BDeliers

Reputation: 84

I finally found my error. I installed JAVA, but I didn't added it to the alternatives. The solution was to add my freshly installed JAVA version as main JAVA with sudo update-alternatives --config java

Upvotes: 0

QuickFix
QuickFix

Reputation: 11721

You have two errors:

  • the android sdk is not found

I think this is because ANDROID_HOME should be more like /home/myusername/Android/Sdk/ (the root of the sdk so that the cordova android platform will be able to choose the sdk version)

  • android command is not found in the path

you need to add to the PATH the folder where the android command is located. This should be /home/myusername/Android/Sdk/tools

Upvotes: 1

Hanh Nguyen
Hanh Nguyen

Reputation: 1

i think you should try to change ANDROID_HOME to /home/myusername/Android/
Almost adding to PATH

:$HOME/Android/tools:$HOME/Android/build-tools:$Home/Android/platform-tools:$PATH


Otherwise i have export the GRADLE_HOME too.
Good Luck!

Upvotes: 0

Related Questions