Package failed on "cordova platform add android"

“package native binary” in the ionic pro dashboard failed:


$ cordova platform add android
Using cordova-fetch for cordova-android@6.2.3
Error: Failed to fetch platform cordova-android@6.2.3
Probably this is either a connection problem, or platform spec is incorrect.
Check your connection and platform name/version/URL.
Failed to get absolute path to installed module
cordova platform add android failed

which cordova-android versions (in package.json) are available for the package process?

Make sure you have installed Android SDK version according to android target version.

Thanks for the feedback! The problem does not affect my local development environment but the “Package native binary” function of Ionic Pro and there I have no influence on the installed Android versions …

cordova-android 6.2.3 is pretty old, you should upgrade to the current 6.4.0.

thanks, but unfortunately not successful:

Using cordova-fetch for cordova-android@6.4.0
Error: Failed to fetch platform cordova-android@6.4.0

https://evothings.com/doc/build/cordova-install-windows.html

Windows?

Again: The problem concerns the “Package native binary” function of Ionic Pro and there I have no influence on the installed Android versions …

Can you create a new Ionic project with ionic start, add the current Android platform and push that to Ionic Pro to see if it builds?

What’s your local ionic info output?

a new created project builds w/o problem, but in the current project the error persists. also after changing to

“cordova-android”: “~6.3.0”

in package.json as it is the case the mentioned new project…


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

@ionic/cli-utils  : 1.19.0
ionic (Ionic CLI) : 3.19.0

global packages:

cordova (Cordova CLI) : 7.1.0 

local packages:

@ionic/app-scripts : 3.1.4
Cordova Platforms  : android 6.3.0
Ionic Framework    : ionic-angular 3.9.2

System:

ios-deploy : 1.9.2 
ios-sim    : 5.0.13 
Node       : v8.6.0
npm        : 5.5.1 
OS         : macOS High Sierra
Xcode      : Xcode 9.1 Build version 9B55 

Environment Variables:

ANDROID_HOME : not set

Misc:

backend : pro

So the problem is not caused by 6.3.0/6.4.0.
Do you see any other differences between the ionic info output of the two projects?

no: twice exactly the same info

Same for package.json and config.xml (minus app names etc of course)?

Interesting. Old builds of mine are also no longer working on Ionic Pro. I believe something is broken on Ionic Pro side. I’m going to raise it on the slack channel.

I believe this is related to their recent upgrade to Android-26.
I’ve registered ticket #8542 on ionic.zendesk.com regarding this failure with old build.
I’ll update here if I fix it.

So I’ve fixed this on my branch.
I ran
rm -Rf plugins/* platforms/*
Made sure these are committed as empty in git
ionic cordova plugin save
ionic cordova prepare android
Make sure the package.json and config.xml are committed.

Doing these steps made my branches all start packaging again.

3 Likes

Still having this issue
cordova platform add android --no-fetch failed

On IONIC PRO - Package for apk

Saving android@~7.0.0 into config.xml file …
cordova platform add android --no-fetch failed
Running after script…
$ run “clean-up”
Running Stage clean-up for Job: 6137017

Same Issue here

Saving android@~7.1.1 into config.xml file …

cordova platform add android --no-fetch failed

Running after script…
$ run “clean-up”
Running Stage clean-up for Job: 6221638