Ionic Package: Error building Android package in Ionic Cloud


#1

I get the following error when trying to build an android package in the cloud:

Error: cordovaProject.projectConfig.getFileResources is not a function

I have tried many different versions of cordova-android but the cloud always seem to build using the same version as shown in the output. We are urgently trying to get a release out and I would appreciate if someone can help us out with this. Below is the output of the build:

Adding android project…
Creating Cordova project for the Android platform:
Path: platforms/android
Package: ***********************
Name: *****
Activity: MainActivity
Android target: android-25
Subproject Path: CordovaLib
Android project created with cordova-android@6.2.3
Error: cordovaProject.projectConfig.getFileResources is not a function


Ionic package fails with message
#2
  1. Can you build the project locally?
  2. What is the exact command you use to run ionic package?
  3. ionic info and content of package.json please.
  4. Also, which version of the platform do you “request” in your config.xml or platforms/android.json? (I don’t know if this actually influences Ionic Package, but still…)

#3
  1. I have always built in the cloud, haven’t tried locally yet

  2. I use the following command to build:
    ionic package build android --profile gc_mobile_prod --release

  3. See file contents at the end of this post

  4. I have tried different versions of cordova-android, however when building in the cloud using ionic build it seems to always use cordova-android@6.2.3. It doesn’t seem as if one can influence this with your local set ups and installed versions

Ionic info:
Cordova CLI: 7.0.0
Ionic Framework Version: 3.1.1
Ionic CLI Version: 2.2.3
Ionic App Lib Version: 2.2.1
Ionic App Scripts Version: 1.3.4
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Linux 3.19
Node Version: v7.4.0
Xcode version: Not installed

package.json content:
{
“name”: “ionic-hello-world”,
“author”: “Ionic Framework”,
“homepage”: “http://ionicframework.com/”,
“private”: true,
“scripts”: {
“build”: “ionic-app-scripts build”,
“watch”: “ionic-app-scripts watch”,
“serve:before”: “watch”,
“emulate:before”: “build”,
“deploy:before”: “build”,
“build:before”: “build”,
“run:before”: “build”
},
“config”: {
“ionic_copy”: “./scripts/copy-custom-libs.js”
},
“dependencies”: {
"@angular/common": “4.0.2”,
"@angular/compiler": “4.0.2”,
"@angular/compiler-cli": “4.0.2”,
"@angular/core": “4.0.2”,
"@angular/forms": “4.0.2”,
"@angular/http": “4.0.2”,
"@angular/platform-browser": “4.0.2”,
"@angular/platform-browser-dynamic": “4.0.2”,
"@angular/platform-server": “^2.2.1”,
"@ionic-native/barcode-scanner": “^3.5.0”,
"@ionic-native/core": “^3.6.1”,
"@ionic-native/network": “^3.6.1”,
"@ionic-native/splash-screen": “3.4.2”,
"@ionic-native/status-bar": “3.4.2”,
"@ionic/cloud-angular": “^0.12.0”,
"@ionic/storage": “2.0.1”,
“chart.js”: “^2.5.0”,
“cordova-android”: “^6.1.2”,
“font-awesome”: “^4.7.0”,
“ionic-angular”: “3.1.1”,
“ionic-native”: “2.2.11”,
“ionicons”: “3.0.0”,
“ng2-charts”: “^1.5.0”,
“rxjs”: “5.1.1”,
“sw-toolbox”: “3.4.0”,
“zone.js”: “^0.8.5”,
“cordova-plugin-console”: “~1.0.4”,
“cordova-plugin-device”: “~1.1.3”,
“cordova-plugin-network-information”: “~1.3.3”,
“cordova-plugin-splashscreen”: “~4.0.0”,
“cordova-plugin-statusbar”: “~2.2.0”,
“cordova-plugin-whitelist”: “~1.3.0”,
“ionic-plugin-deploy”: “~0.6.6”,
“ionic-plugin-keyboard”: “~2.2.1”,
“phonegap-plugin-barcodescanner”: “~6.0.6”
},
“devDependencies”: {
"@ionic/app-scripts": “1.3.4”,
“typescript”: “~2.2.1”
},
“description”: “myGCMobile: A GrandCentral Project”,
“cordovaPlugins”: [
“cordova-plugin-device”,
“cordova-plugin-console”,
“cordova-plugin-whitelist”,
“cordova-plugin-splashscreen”,
“cordova-plugin-statusbar”,
“ionic-plugin-keyboard”
],
“cordovaPlatforms”: [],
“cordova”: {
“plugins”: {
“cordova-plugin-console”: {},
“cordova-plugin-device”: {},
“cordova-plugin-network-information”: {},
“cordova-plugin-splashscreen”: {},
“cordova-plugin-statusbar”: {},
“cordova-plugin-whitelist”: {},
“ionic-plugin-deploy”: {},
“ionic-plugin-keyboard”: {},
“phonegap-plugin-barcodescanner”: {
“CAMERA_USAGE_DESCRIPTION”: " "
}
},
“platforms”: [
“android”
]
}
}


#4

I did the following which seems to have resolved the issue:

  1. I removed the android platform
    ionic platform rm android

  2. I then added an older version of the platform:
    ionic platform add android@6.1.2

After doing the above and running ionic build again it built successfully. I have tried doing this before and it didn’t work. Not sure what changed now, just happy that it went through successfully.


#5

@jean_smit07 i did the same to use android@6.1.2 but since then am getting “The package appears to be corrupt” when i try to open the apk on my phone. How did you work around that?


#6

For those interested, ionic platform add android@6.1.2 didn’t change the android version used in the cloud for me.
But ionic platform add android@6.1.2 --save successfully changed it.


#7

@krazineurons I’ve got the same problem here. My packages now always come back corrupted. Did you find a solution?


#8

I am having the same issue. Has anyone found a solution? I can run locally with ionic cordova run android


#9

http://ionicframework.com/support#support
(Scroll down to “Business and Customer Support”)


#10

Try using

ionic platform update android