Cannot build for Android with Ionic 4


I’m trying run the command “ionic cordova run android” but I always receive this error:

cordova build android
shell.js: internal error
Error: EPERM: operation not permitted, chmod ‘…platforms/android/app/src/main/res/xml/config.xml’

I already executed the command with sudo and also change config.xml permissions to 777, but I end up with the same error.

I’ve tried the following things:

.Remove and add the platform Android
.Change permissions for config.xml file
.Execute the command with sudo

My version of Node: 10.15.3 lts
My version of Ionic: 4.12.0

Anyone can help me? I just want to test my app on the emulator

sorry couldn’t help.
Even i face the same issue.
would love to see community response to this.

If my memory is correct I think this is the same issue happened to me when I created a new project with Ionic 4. What I did is I removed the platforms, www folder and the config file then add them again

ionic cordova platform add android
ionic cordova build android --prod

Hope this helps.

If you want build/run android apk file then you have must install android studio and create blank project and add AVD. After this you can use ionic cordova platform add android to add android platform.

Hi @claudiocfls
remove android platform, don’t give sudo command for ionic cordova platform add android. because android and ios platform internal files dynamically generated. generating time process control unable to modify the newly generated files because no access for modifications. that time you will face above error. just go with normal commands. like
ionic cordova platform add android@8.0.0

better to use ionic 4 with cordova-android@8.0.0

We have a captain here!

This worked for me! Thank you!

I had done this before but I was still facing the same error

Thank you for your answer, but I already had done this and didn’t works. The solution was remove www folder and config files after remove platforms.