Ionic requires android goal 19, I have goal 21

Trying to install ionic, when adding Android platform, I get the following error

Error: Please install Android target "android-19". Hint: Run "android" from your command-line to open the SDK manager. at /home/algotree/.cordova/lib/npm_cache/cordova-android/3.6.4/package/bin/lib/check_reqs.js:174:19 at _fulfilled (/home/algotree/.cordova/lib/npm_cache/cordova-android/3.6.4/package/bin/node_modules/q/q.js:798:54) at self.promiseDispatch.done (/home/algotree/.cordova/lib/npm_cache/cordova-android/3.6.4/package/bin/node_modules/q/q.js:827:30) at Promise.promise.promiseDispatch (/home/algotree/.cordova/lib/npm_cache/cordova-android/3.6.4/package/bin/node_modules/q/q.js:760:13) at /home/algotree/.cordova/lib/npm_cache/cordova-android/3.6.4/package/bin/node_modules/q/q.js:574:44 at flush (/home/algotree/.cordova/lib/npm_cache/cordova-android/3.6.4/package/bin/node_modules/q/q.js:108:17) at process._tickCallback (node.js:419:13) Error: /home/algotree/.cordova/lib/npm_cache/cordova-android/3.6.4/package/bin/create: Command failed with exit code 8 at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:135:23) at ChildProcess.EventEmitter.emit (events.js:98:17) at maybeClose (child_process.js:753:16) at Process.ChildProcess._handle.onexit (child_process.js:820:5) 

But I already have Android 21 installed. How can I use this without installing target-19?

+5
source share
2 answers

This is because there is a script flag that is checked to see the target android virsion when the ionic create myApp.

This script is located inside the cordova directory - C:\Users\[user]\.cordova\lib\npm_cache\cordova-android\3.6.4\package\framework\project.properties (for windows).

When you enter the project.properties file, you will see something similar to the one below.

  1. split.density = false

  2. target = android-19

  3. APK configurations =

  4. renderscript.opt.level = 0

  5. android.library = true

You will need to change the line with target=android-19 , say target=android-21 I hope this helps, since I'm completely new to developing ion and hybrid mobile devices, but I remember reading about several people having the same problem . I myself ran into this error, although I had no problem installing android-19 to fix it.

Another way to check available targets without digging through each directory in your file explorer is to run the android list target from C:\Users\[user] .

+10
source

find the folder from the project root directory [project_root]/platforms/android/project.properties and replace the target preferred

target=android-21 android.library.reference.1=CordovaLib

+3
source

Source: https://habr.com/ru/post/1213703/


All Articles