1 votes

ERROR: /platforms/Android/gradlew: Command failed with exit code EACCES IONIC v4

very good, I have a problem when I compile my application, when I add the platform no problem ( ionic cordova platform add android ), in fact I run ionic cordova prepare android and everything goes very well, I can open it in the Android studio without problems, my error arises when I want to compile it, I have already searched in google, and I have not been able to solve it, according to what I read, it seems to me that it has to do with gradle.

First Run:

cordova build android

Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=/usr/local/share/android-sdk (recommended setting)
ANDROID_HOME=/usr/local/share/android-sdk (DEPRECATED)
Subproject Path: CordovaLib
Subproject Path: app
/Users/javier/Developer/Proyectos/TeamElite/CarryApp/Ionic4/APP_TRUCK_FRONT/platforms/android/gradlew: Command failed with exit code EACCES

and there I got the error, so I then ran it with the --verbose flag to get more information:

cordova build --verbose android

No scripts found for hook "before_build".
No scripts found for hook "before_prepare".
Checking config.xml and package.json for saved platforms that haven't been added to the project
Config.xml and package.json platforms are the same. No pkg.json modification.
Package.json and config.xml platforms are different. Updating config.xml with most current list of platforms.
PlatformApi successfully found for platform android
Checking for saved plugins that haven't been added to the project
Checking for any plugins added to the project that have not been installed in android platform
No differences found between plugins added to project and installed in android platform. Continuing...
Generating platform-specific config.xml from defaults for android at /platforms/android/app/src/main/res/xml/config.xml
Merging project's config.xml into platform-specific android config.xml
[Gradle Properties] Preparing Configuration
[Gradle Properties] Appending default configuration properties
[Gradle Properties] Appending custom configuration properties
[Gradle Properties] Updating and Saving File
Merging and updating files from [www, platforms/android/platform_www] to platforms/android/app/src/main/assets/www
platforms/android/app/src/main/res/drawable-port-xxxhdpi/screen.png (updated file)
This app does not have additional resource files defined
Prepared android project successfully
No scripts found for hook "after_prepare".
No scripts found for hook "before_compile".
Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=/usr/local/share/android-sdk (recommended setting)
ANDROID_HOME=/usr/local/share/android-sdk (DEPRECATED)
Subproject Path: CordovaLib
Subproject Path: app
Running command: 
/platforms/android/gradlew cdvBuildDebug -b 
/platforms/android/build.gradle
Command finished with error code EACCES: 
/platforms/android/gradlew cdvBuildDebug,-b,
/platforms/android/build.gradle
/platforms/android/gradlew: Command failed with exit code EACCES
Error: 
/platforms/android/gradlew: Command failed with exit code EACCES
    at ChildProcess.whenDone (/node_modules/cordova-common/src/superspawn.js:125:23)
    at ChildProcess.emit (events.js:193:13)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:253:12)
    at onErrorNT (internal/child_process.js:429:16)
    at processTicksAndRejections (internal/process/task_queues.js:81:17)

0 votes

I also have the same problem, it is appreciated to post the solution if found. Greetings.

1 votes

@TeamElite What is your relationship with Jorge Javier? are you the same person?

0 votes

@AlvaroMontoro, hello, Different People.

4voto

They simply need to give permissions to the gradlew file:

chmod 777 platforms/android/gradlew

with this download the correct version and it should work...hope it helps.

0voto

It is a gradle permissions problem. You have to execute the following commands:

$ chmod a+x <your-project-directory>/platforms/android/gradlew
$ chmod a+x <your-project-directory>/platforms/android/cordova/build

Greetings.

HolaDevs.com

HolaDevs is an online community of programmers and software lovers.
You can check other people responses or create a new question if you don't find a solution

Powered by:

X