Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ionic requires android target 19 , I have target 21 installed

Trying to install ionic, when adding android platform I am getting 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 have android-21 installed already . How can I use that without installing target-19?

like image 989
32teeths Avatar asked Feb 19 '15 11:02

32teeths


2 Answers

This happens because there is a script that is checked to see the target android virsion when you run the command ionic create myApp.

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

When you go into the project.properties file you will see something similar to the below.

  1. split.density=false

  2. target=android-19

  3. apk-configurations=

  4. renderscript.opt.level=O0

  5. android.library=true

You will need to ammend the line that has target=android-19, to say target=android-21 Hope this helps as I am quite new to Ionic and hybrid mobile development but I remember reading about a few people having the same issue. I encountered this error myself though I did not have an issue with installing android-19 to fix it.

Another way you can check available targets with out digging down through each directory with in your file explorer is by running android list target from within C:\Users\[user].

like image 190
TheHeff Avatar answered Oct 19 '22 11:10

TheHeff


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

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

like image 25
Lawrence Paje Avatar answered Oct 19 '22 12:10

Lawrence Paje