22

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?

1
  • i think its because of your path Commented Aug 4, 2016 at 12:39

7 Answers 7

52

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 :)

Sign up to request clarification or add additional context in comments.

4 Comments

My Pleasure Thanks :)
Krunal, you have no idea how many headaches your solution has spared me. Been looking everywhere. Thank you for saving me a lot of time and frustration!
Should use +x instead of 777. This make it executable without effecting other permission settings on gradle
I had to do this targeting ..../bin for it to work. Eg. sudo chmod -R 777 /Applications/Android\ Studio.app/Contents/gradle/gradle-4.1/bin
29

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.

4 Comments

is it giving any error ? did you refer this : stackoverflow.com/a/32314465/6449750
can you try to build project after moving project to another location ? Try command on your desktop folder too.
then its problem of your user directory in OS volume. try hitting command on that. i had this same problem.
8

Use the verbose when you make your cordova build:

cordova build -verbose

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

Comments

7

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.

1 Comment

Thank you. You explained everything. Though -verbose didn't work. But I got to build my ionic project finally. Thanks a lot!
3

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

Comments

0

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"

Comments

0

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

sudo npm i 

Hope It get works ..Thanks..!

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.