22
votes

i developed one project in ionic2

while i am doing ionic build android i am getting this error

enter image description here

my ionic info is

Cordova CLI: 6.3.0

Ionic Framework Version: 2.0.0-beta.10

Ionic CLI Version: 2.0.0-beta.36

Ionic App Lib Version: 2.0.0-beta.19

OS: Distributor ID: Ubuntu Description: Ubuntu 14.04.5 LTS

Node Version: v4.4.7

I searched in google but no solution works for me..

How can i fix this Bug?

7
i think its because of your pathMohan Gopi

7 Answers

29
votes

hit this command

sudo chmod -R a+rwx /appfolder

It is caused by permission problem. More info on problem here.

If this does not solve your problem then its probably issue of permission in your user profile directory. Try above command on user directory. It will take some time to apply permission.

Regards.

54
votes

This is Permission Error While Building App

You Need to Give Permission Gradle

sudo chmod -R 777 /Applications/Android\ Studio\ 3.0\ Preview.app/Contents/gradle

Enjoy :)

8
votes

Use the verbose when you make your cordova build:

cordova build -verbose

It will return to you the path that requires the chmod +x

7
votes

I was using Cordova to run my Hybrid app on my Android device, and I got this error twice during the unsuccessful build ...

Error: spawn EACCES

@Krunel Vaghela's answer above helped me somewhat ...

This is Permission Error While Building App

You Need to Give Permission Gradle

sudo chmod -R 777 /Applications/Android\ Studio\ 3.0\ Preview.app/Contents/gradle

But I kept having this error: "chmod: -r: no such file or directory"

I was using this command:

[Sandis-Macbook-Pro:Users sandi$ sudo chmod -R 777 /Applications/Android Studio.app/Contents/gradle/gradle-4.1/bin/gradle

Note that my Android app is named "Android Studio.app" (with a space in the name). Solution is to simply wrap the path in quotes like so:

[Sandis-Macbook-Pro:Users sandi$ sudo chmod -R 777 "/Applications/Android Studio.app/Contents/gradle/gradle-4.1/bin/gradle"

NOTE: In order to find out which folder was having the permissions problem, I had to use this command:

sudo build -verbose

Which yielded the path to the permissions problem folder like this:

ANDROID_HOME=/Users/sandi/Library/Android/sdk
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_151.jdk/Contents/Home
Running command: "/Applications/Android Studio.app/Contents/gradle/gradle-4.1/bin/gradle" -p /Users/sandi/Desktop/CORDOVA_NOV16/HHUB_NOV17/hhub_CURRENT/platforms/android wrapper -b /Users/sandi/Desktop/CORDOVA_NOV16/HHUB_NOV17/hhub_CURRENT/platforms/android/wrapper.gradle
Error: spawn EACCES

So take the path after "Running command:" - put that, inside quotes, after the ...

chmod -r 777 

And that's what saved my day.

3
votes

Had the same problem, I got it fixed by giving 777 permissions on my Sdk folder : chmod -R 777 /YOURINSTALLOFANDROID/Sdk

0
votes

After upgrading to Android 3.2, gradle version has been changed up to 4.6.

So I had to use this following command to modify gradle file permission in my Mac Terminal.

sudo chmod 755 "/Applications/Android Studio.app/Contents/gradle/gradle-4.6/bin/gradle"
0
votes

Just Remove "node_modules" folder and re-install it using

sudo npm i 

Hope It get works ..Thanks..!