Build for android shows error

I try to build my project for android and i get the following error:

Error: TypeError: cordovaProject.projectConfig.getFileResources is not a functio
n

command used :

ionic cordova build android --verbose

Environment info are:

Ionic:

   ionic (Ionic CLI) : 4.0.1 (C:\Users\user\AppData\Roaming\npm\node_modules\ion
ic)
   Ionic Framework   : unknown
   @ionic/v1-toolkit : not installed

Cordova:

   cordova (Cordova CLI) : 5.4.1
   Cordova Platforms     : android 6.3.0, ios 3.9.2

System:

   Android SDK Tools : 26.0.2
   NodeJS            : v10.4.0 (C:\Program Files\nodejs\node.exe)
   npm               : 2.15.12
   OS                : Windows 7

Environment:

   ANDROID_HOME : C:\Users\user\AppData\Local\Android\sdk

Can someone show how to fix this?

Your Cordova tooling seems to be out of date (Actually: SUPER old!), which might be causing all kinds of problems.
You can read about how to figure out the current Cordova versions and how to update CLI, platforms and plugins here: How to update Cordova CLI, Platforms and Plugins Ā· ionic.zone

Hey, thanks for responding!
I updated the cordova version to the latest 8.0 now Iā€™m getting this type of error:

Execution failed for task ā€˜:app:processReleaseResourcesā€™. > Failed to execute aapt.

followed some steps from this link but still the same

What is your new ionic info output now?

have you tried npm outdated & npm update??

My new ionic info is:


   ionic (Ionic CLI) : 4.0.1 (C:\Users\user\AppData\Roaming\npm\node_modules\ion
ic)
   Ionic Framework   : unknown
   @ionic/v1-toolkit : not installed

Cordova:

   cordova (Cordova CLI) : 8.0.0
   Cordova Platforms     : android 7.1.1

System:

   Android SDK Tools : 26.0.2
   NodeJS            : v10.4.0 (C:\Program Files\nodejs\node.exe)
   npm               : 6.2.0
   OS                : Windows 7

Environment:

   ANDROID_HOME : C:\Users\user\AppData\Local\Android\sdk


That is a bit strange, but the rest looks good.

Can you please create a new project with ionic start --type ionic1 and see if you can build that for Android?

i created new project, and the build was successful :confused:

Perfect - now just compare the both projects config.xml and package.json to find the difference. It might help to remove and re-add the platforms or plugins as well.

I transfered my old project to the new created project and the build works.

1 Like

Just a thought if someone else happens to have this kind of problem: it happened to me when updating my project and the problem was too long paths. My project was stored in c:\users\dude\documentsā€¦ Which additionned to ionic folder structure ended up too long. You can move your project to c:\ionicProject and try again, you can also specify a build directory in grade but I donā€™t remember the exact parameter, you could look it up though. Good luck !

1 Like