11

I'm trying to build a android cordova based application but I'm always getting this error.

Here the error message on the cli : cli-error

But, as you can see on the next picture, I have installed the android-23 platform with android sdk manager : Android SDK manager

Also, the environment variable ANDROID_HOME is correctly set and I have android-sdk\tools and android-sdk\platform-tools in my PATH.

Does anyone have an idea of what could be the problem ?

Adrien
  • 171
  • 1
  • 1
  • 9
  • http://stackoverflow.com/questions/42668185/could-not-find-gradle-wrapper-within-android-sdk-might-need-to-update-your-andr – shareef Mar 14 '17 at 17:30

5 Answers5

10

We need to install all the platform tool for android API version 23. As shown in the image. Also, Need to install all the API Version 23.

enter image description here

enter image description here

Restart your node js command line tool and try again with : cordova build command, it will work now and download the dependent files.

Mayank Nimje
  • 573
  • 4
  • 16
  • As you may see in the answers, I found what was the problem, it was related to the path of my project. However, it's not necessary to install all the items under API23. With just SDK platform and Google APIs, it works. – Adrien Jul 05 '16 at 09:51
  • @Adrien then the apk that will be built will work one android 4.2.2 for example if we install sdk platform and google apis under PI23 and all the sdk for api17? – user1788736 Sep 19 '16 at 17:11
  • @user1788736 If you build your app for Android 6 (with API 23) it will work on Android 4.2.2 unless you use features that are not available for that platform. – Adrien Sep 21 '16 at 10:59
4

Ok, the problem seems to come from the path of my project. There is some special characters like '-' and if I try to build a cordova App from another folder (with a path without any '-'), everything works great !

Adrien
  • 171
  • 1
  • 1
  • 9
  • Hello Adrien :- i am facing similiar issue as you faced earlier , can you please give a look at my post :- http://stackoverflow.com/questions/36125338/issue-with-android-m-permissions-while-adding-platform-ionic?noredirect=1#comment59899341_36125338 – user2028 Mar 21 '16 at 12:25
  • Sorry but I can't figure out how to solve your problem. Did you try to create your projet on /home to see if it really was a similar issue ? (since my problem was coming from my project path) – Adrien Apr 03 '16 at 14:06
0

Kindly locate where android.bat is in your android sdk file, After locating run it and it will prompt android sdk manager so make sure you installed all necessary package for android 23. This should work for you, I hope it help??

Yusuf Adeyemo
  • 389
  • 3
  • 12
  • Thanks for your answer. In fact I already had all necessary packages for android 23, the problem was solved just by moving the project in a location without special characters in its path. – Adrien Apr 05 '16 at 20:49
0

When adding android platform to cordova you better use your specific targer ( dont follow posts on internet telling you to modify xml files or project.properties).

to do so just use:

cordova platform add android@x.x.x

where x.x.x is your android version for example "4.1.1" will set min sdk version to "22" if android was already added to your cordova project remove it first:

cordova platform remove android

Hope it helps anyone looking for same answer I was looking for.

ProllyGeek
  • 15,517
  • 9
  • 53
  • 72
0

Here's what worked for me (MAC OS).

Change the files:

myApp/platforms/android/project.properties
myApp/platforms/android/CordovaLib/project.properties

To the target sdk you installed. In my case, the error was asking me to install android-28. Then I opened android studio and installed android-27 and changed these files to android-27 also. And corodova requirements are fine now!

Pika Supports Ukraine
  • 3,612
  • 10
  • 26
  • 42
grc
  • 304
  • 1
  • 5
  • 21