# Cannot build for Android with Ionic 4

**URL:** <https://forum.ionicframework.com/t/cannot-build-for-android-with-ionic-4/160164>\
**Category:** Ionic Framework\
**Created:** [March 28, 2019, 12:39am UTC](https://forum.ionicframework.com/t/cannot-build-for-android-with-ionic-4/160164 "2019-03-28T00:39:33Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![claudiocfls](https://avatars.discourse-cdn.com/v4/letter/c/3ec8ea/32.png) [@claudiocfls](https://forum.ionicframework.com/u/claudiocfls)\
**Post date:** [March 28, 2019, 12:39am UTC](https://forum.ionicframework.com/t/cannot-build-for-android-with-ionic-4/160164/1 "2019-03-28T00:39:33Z")

</div>

Hi,

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

---

<div class="post-metadata">

**Author:** ![ryanjenson90](https://avatars.discourse-cdn.com/v4/letter/r/54ee81/32.png) [@ryanjenson90](https://forum.ionicframework.com/u/ryanjenson90)\
**Post date:** [March 28, 2019, 3:42am UTC](https://forum.ionicframework.com/t/cannot-build-for-android-with-ionic-4/160164/2 "2019-03-28T03:42:52Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![AJ.M.A](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/aj.m.a/32/124943_2.png) [@AJ.M.A](https://forum.ionicframework.com/u/AJ.M.A)\
**Post date:** [March 28, 2019, 5:52am UTC](https://forum.ionicframework.com/t/cannot-build-for-android-with-ionic-4/160164/3 "2019-03-28T05:52:42Z")

</div>

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

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

```

Hope this helps.

---

<div class="post-metadata">

**Author:** ![gokujy](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/gokujy/32/117753_2.png) [@gokujy](https://forum.ionicframework.com/u/gokujy)\
**Post date:** [March 28, 2019, 6:35am UTC](https://forum.ionicframework.com/t/cannot-build-for-android-with-ionic-4/160164/4 "2019-03-28T06:35:54Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![SrinivasK](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/srinivask/32/124455_2.png) [@SrinivasK](https://forum.ionicframework.com/u/SrinivasK)\
**Post date:** [March 28, 2019, 7:31am UTC](https://forum.ionicframework.com/t/cannot-build-for-android-with-ionic-4/160164/5 "2019-03-28T07:31:30Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![claudiocfls](https://avatars.discourse-cdn.com/v4/letter/c/3ec8ea/32.png) [@claudiocfls](https://forum.ionicframework.com/u/claudiocfls)\
**Post date:** [March 28, 2019, 11:57pm UTC](https://forum.ionicframework.com/t/cannot-build-for-android-with-ionic-4/160164/6 "2019-03-28T23:57:37Z")

</div>

We have a captain here!

---

<div class="post-metadata">

**Author:** ![claudiocfls](https://avatars.discourse-cdn.com/v4/letter/c/3ec8ea/32.png) [@claudiocfls](https://forum.ionicframework.com/u/claudiocfls)\
**Post date:** [March 28, 2019, 11:59pm UTC](https://forum.ionicframework.com/t/cannot-build-for-android-with-ionic-4/160164/7 "2019-03-28T23:59:01Z")

</div>

This worked for me! Thank you!

---

<div class="post-metadata">

**Author:** ![claudiocfls](https://avatars.discourse-cdn.com/v4/letter/c/3ec8ea/32.png) [@claudiocfls](https://forum.ionicframework.com/u/claudiocfls)\
**Post date:** [March 28, 2019, 11:59pm UTC](https://forum.ionicframework.com/t/cannot-build-for-android-with-ionic-4/160164/8 "2019-03-28T23:59:53Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![claudiocfls](https://avatars.discourse-cdn.com/v4/letter/c/3ec8ea/32.png) [@claudiocfls](https://forum.ionicframework.com/u/claudiocfls)\
**Post date:** [March 29, 2019, 12:01am UTC](https://forum.ionicframework.com/t/cannot-build-for-android-with-ionic-4/160164/9 "2019-03-29T00:01:37Z")

</div>

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.
