Build for android shows error

#1

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?

#2

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: https://ionic.zone/cordova/update

#3

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

#4

What is your new ionic info output now?

#5

have you tried npm outdated & npm update??

#6

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


#7

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?

#8

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

#9

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.

#10

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

1 Like
#11

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