I\'m trying to build a Cordova Android project using the most recent tools. I followed the instructions here:
$ cordova create myApp com.myCompany.myApp myAp
“Android target: not installed”
Please install Android target / API level: "android-25".
You need to create an Android Virtual Device (API level: "android-25" or latest) or need to add android real device.
Also you can import the project in Android Studio and run.
You can check here:
https://cordova.apache.org/docs/en/latest/guide/platforms/android/index.html
https://developer.android.com/studio/command-line/adb.html
If you have android studio installed then you might want to try:
export PATH="$PATH:/home/<username>/android-studio/gradle/<gradle-4.0>/bin"
This solved my problem.
same problem but very simple on Mac with brew:
Sample problem but I found my solution with brew.
1. Make sure you have the latest Android Studio installed.
2. Confirm from SDK manager that you have the required SDKs installed.
3. (optional)you could have an AVD installed as well.
4. install Homebrew.
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
5. Then run brew update to make sure Homebrew is up to date.
brew update
6. Run brew doctor to make sure everything is safe
brew doctor
7. Add Homebrew's location to your $PATH in your .bash_profile or .zshrc file.
export PATH="/usr/local/bin:$PATH"
8. If you don't have Node already installed, add:
brew install node
9. (Optional) To test out your Node and npm install, try installing Grunt (you might be asked to run with sudo)
npm install -g grunt-cli
10. Install Gradle
brew install gradle
Run: cordova run android --device
with you device connected on a Mac and you have gradle working this time.
I followed this Qiita tutorial to solve my trouble.
Environment: Cordova 8.1.1
, Android Studio 3.2
, cordova-android 7.0.0
.profile
file.export PATH="/Applications/Android Studio.app/Contents/gradle/gradle-4.6/bin":$PATH
source ~/.profle
cordova build android
PS: If cordova-android@7.0.0
causes build error, downgrade your platform version to 6.3.0.
Extending https://stackoverflow.com/users/5540715/surendra-shrestha answer for linux (~mint) users:
1. Install Android Studio (many tools have been deprecated for command line, so this is likely required). Asuming you follow the author instrucctions, your Android Studio will be installed in /usr/local/android-studio/. At the time of writing, the gradle version in Android Studio is 3.2, look at yours with ls /usr/local/android-studio/gradle/
.
2. Add your gradle command, this can be done extending the PATH, as @surendra-shrestha suggested (should be written in ~/.bashrc to preserve the PATH change), adding an alias echo 'export alias gradle=/usr/local/android-studio/gradle/gradle-3.2/bin/gradle' >> ~/.bashrc && source ~/.bashrc
. Or making a symbolic link: sudo ln -sn /usr/local/android-studio/gradle/gradle-3.2/bin/gradle /usr/bin/gradle
(this was my choice).
3. Run cordova requirements
to check everyhing is OK, should output something like:
Requirements check results for android:
Java JDK: installed 1.8.0
Android SDK: installed true
Android target: installed android-26,android-25,android-24,android-23,android-22,android-21,android-19,Google Inc.:Google APIs:19
Gradle: installed /usr/local/android-studio/gradle/gradle-3.2/bin/gradle