Ionic cordova platform add android fails to generate android platform properly


#1

For some reason when i run “ionic cordova platform add android” it never generates the gradlew.exe and gradle folder you would normally see in this structure which then causes my ionic build android and ionic run android to subsequently fail. Any ideas what is going on?

Attached is a pic of the folder i get generated you will see gradlew.exe and gradle folder is missing Picture of incomplete folder (Click here)

Laptop-MBP:Ionic3 myLaptop$ ionic info

cli packages: (/usr/local/lib/node_modules)

@ionic/cli-utils  : 1.15.1
ionic (Ionic CLI) : 3.15.1

global packages:

cordova (Cordova CLI) : 7.1.0 

local packages:

@ionic/app-scripts : 2.1.0
Cordova Platforms  : android 6.3.0 ios 4.3.1
Ionic Framework    : ionic-angular 3.5.3

System:

Android SDK Tools : 24.3.4
ios-deploy        : 1.9.1 
ios-sim           : 5.0.13 
Node              : v6.9.4
npm               : 3.10.10 
OS                : OS X El Capitan
Xcode             : Xcode 8.2.1 Build version 8C1002 

Environment Variables:

ANDROID_HOME : /Users/laptop/Library/Android/sdk

Misc:

backend : pro

#2

Can you remove the platform and re-add it and post the whole output of that?
Is ionic cordova requirements happy? What does it output?


#3

laptop-MBP:hmjava-inspira laptop$ ionic cordova requirements

cordova requirements

Requirements check results for android:

Java JDK: installed 1.8.0

Android SDK: installed true
Android target: not installed
Please install Android target / API level: “android-26”.

Hint: Open the SDK manager by running: /Users/laptop/Library/Android/sdk/tools/android
You will require:

  1. “SDK Platform” for API level android-26
  2. "Android SDK Platform-tools (latest)
  3. “Android SDK Build-tools” (latest)

Gradle: installed /Applications/Android Studio.app/Contents/gradle/gradle-2.4/bin/gradle

Error: Some of requirements check failed


#4

Do that and check if maybe android-27 is installed.


#5

Here is the ionic platform add output and the newest cordova reuqirements… still did not work (android-27) is not installed

laptop-MBP:testionic laptop$ ionic cordova platform add android

cordova platform add android --save
Using cordova-fetch for cordova-android@~6.3.0

Adding android project…

Creating Cordova project for the Android platform:

Path: platforms/android

Package: com.testionic

Name: TestIonic

Activity: MainActivity

Android target: android-26

Subproject Path: CordovaLib
Android project created with cordova-android@6.3.0
Installing “com.lampa.startapp” for android

Installing “cordova-plugin-app-version” for android
Installing “cordova-plugin-appavailability” for android
Installing “cordova-plugin-console” for android

Installing “cordova-plugin-device” for android

Installing “cordova-plugin-dialogs” for android
Installing “cordova-plugin-health” for android
Subproject Path: CordovaLib
Installing “cordova-plugin-inappbrowser” for android
Installing “cordova-plugin-splashscreen” for android
Installing “cordova-plugin-statusbar” for android

Installing “cordova-plugin-whitelist” for android

           This plugin is only applicable for versions of cordova-android greater than 4.0. If you have a previous platform version, you do *not* need this plugin since the whitelist will be built in.

Installing “ionic-plugin-keyboard” for android

Installing “mx.ferreyra.callnumber” for android

–save flag or autosave detected

Saving android@~6.3.0 into config.xml file …

laptop-MBP:testionic laptop$ ionic cordova requirements

cordova requirements

Requirements check results for android:

Java JDK: installed 1.8.0

Android SDK: installed true
Android target: installed Google Inc.:Google APIs:23,android-26,android-25,android-23

Gradle: installed /Applications/Android Studio.app/Contents/gradle/gradle-2.4/bin/gradle

laptop-MBP:hmjav laptop$ ionic info

cli packages: (/usr/local/lib/node_modules)

@ionic/cli-utils  : 1.15.1
ionic (Ionic CLI) : 3.15.1

global packages:

cordova (Cordova CLI) : 7.1.0 

local packages:

@ionic/app-scripts : 3.0.1
Cordova Platforms  : android 6.3.0
Ionic Framework    : ionic-angular 3.7.1

System:

Android SDK Tools : 25.2.5
ios-deploy        : 1.9.1 
ios-sim           : 5.0.13 
Node              : v6.9.4
npm               : 3.10.10 
OS                : OS X El Capitan
Xcode             : Xcode 8.2.1 Build version 8C1002 

Environment Variables:

ANDROID_HOME : /Users/laptop/Library/Android/sdk

Misc:

backend : pro

#6

Any ideas? i am so confused what is causing this… i have been using ionic cordova for a while and this error just started occuring after recent ionic upgrade


#7

No idea.

There were several releases to Android tooling yesterday that seems to cause all kinds of funny things, but I can’t see that here.

Create a new project with ionic start and try there.


#8

Sigh even in the new project it failed to properly generate


#9

Just update for anyone curious i tried this on another macbook (same issue)… i then tried this on a windows (same issue)… i am going to try and reinstall all my android sdk/studiio now


#10

Resolved the issue needed to chmod +x my gradle file on all my macs… i guess its an ionic 3.7 / macbook issue because it replicated on 2 brand new systems