Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cordova Error using Cordova-Android 6.2.0 - getFileResources is not a function

I have an ionic/cordova project using:

[email protected] [email protected] cordova cli 6.4.0 ionic 1.3.3 

When I try to add the Android platform, I get the following output

================  $ ionic platform add [email protected]  Adding android project...   Creating Cordova project for the Android platform:      Path: platforms/android     Package: com.ionicframework.name     Name: name     Activity: MainActivity     Android target: android-25  Subproject Path: CordovaLib  Android project created with [email protected] 

Error: cordovaProject.projectConfig.getFileResources is not a function

like image 480
IonicBurger Avatar asked Apr 03 '17 22:04

IonicBurger


2 Answers

It seems this issue is related to a bug in [email protected], as confirmed here: https://issues.apache.org/jira/browse/CB-12633

I have now updated my system to cordova-cli - [email protected] and [email protected], and it seemed to work.

Update to version 6 of cordova cli with:

npm install -g cordova@6 

And then add the correct version of cordova-android

cordova platform add android@6 

Not directly related to this issue, but once I got it working, my system did complain about the gradle path not being set when I tried building my app, and so I followed the steps here: https://gradle.org/install#with-homebrew, and now all builds successfully.

like image 157
IonicBurger Avatar answered Oct 03 '22 08:10

IonicBurger


update cordova

npm install -g cordova 

and then try to add platform or if any problem with new version of cordova then use below

There is a problem with cordova version 6.4.0 and android 6.2.1. So, please try with below compatible versions

cordova version must be 6.4.0

npm install -g [email protected] 

Install android in your project

cordova platform add [email protected]   

or

ionic platform add [email protected] 
like image 38
Veerendra Borra Avatar answered Oct 03 '22 10:10

Veerendra Borra