Ion Cordova builds Android: Error: Generating Eacces

I have seen many references to change the execution attributes of gradle through chmod, (x or 755)… These seem to make no difference.
Even if I run, I still get the message: < br>sudo ion cordova to build android

I have these settings:

The only thing I can think of is that there is no execution attribute in the hook of the plug-in. It may be…

Plugins-no custom hooks folder entries

sudo ion cordova build android< /p>

....
> cordova build android
ANDROID_HOME=/Users/jgf/Library/Android/sdk
JAVA_HOME=/Library/ Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home
Subproject Path: CordovaLib
Error: spawn EACCES

[ERROR] An error occurred while running cordova build android ( exit code 1).

One of the most annoying things about this error is that it does not give you enough details and hides the root cause of the problem…
I have tried adding things like –verbose And the –release flag, but there is no change in solving the problem.

Running Mac OS X High Sierra 10.13.2

ionic information

cli packages: (/Users/jgf/.nvm/versions/node/v8.9.3/lib/node_modules)

@ionic/cli-utils: 1.18.0< br /> ionic (Ionic CLI): 3.18.0

global packages:

cordova (Cordova CLI): 7.0.1

local packages:

@ionic/app-scripts: 3.1.5
Cordova Platforms: android 6.4.0 browser 4.1.0 ios 4.4.0
Ionic Framework: ionic-angular 3.9.2

System:
< br /> Android SDK Tools: 26.1.1
Node: v8.9.3
npm: 5.6.0
OS: macOS High Sierra
Xcode: Xcode 9.2 Build version 9C40b

Environment Variables:

ANDROID_HOME: /Users/jgf/Library/Android/sdk

Misc:

backend: legacy

cordova platform version

Installed platforms:
android 6.4.0
browser 4.1.0
ios 4.4. 0
Available platforms:
blackberry10 ~3.8.0 (deprecated)
osx ~4.0.1
webos ~3.7.0

cordova build android –verbose

No scripts found for hook "before_build".
No scripts found for hook "before_pre pare".
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.< br />Package.json and config.xml platforms are different. Updating config.xml with most current list of platforms.
PlatformApi successfully found for platform android
Checking config.xml 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 /opt/IonicProjects/aews_official_rc_1.2.09/platforms/android/res/xml/config.xml
Merging project's config.xml into platform-specific android config.xml
Merging and updating files from [www, platforms/android/platform_www] to platforms/android/assets/www
Wrote out android application name "ET-Mobile" to /opt/IonicProjects/aews_official_rc_1.2.09/platforms/android/res/values/strings.xml
android-versionCode not found in config.xml. Generating a code based on version in config.xml (0.0.1): 1
Wrote out Android package name "com.extratechnology.etmobile" to /opt/IonicProjects/aews_official_rc_1.2.09/platforms/android/src/com/extratechnology/etmobile/MainActivity .java
Updating icons at platforms/android/res
Updating splash screens at platforms/android/res
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".
ANDROID_HOME=/Users/jgf/Library/Android/sdk
JAVA_HOME=/Library/Java /JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home
Subproject Path: CordovaLib
Running command: /opt/IonicProjects/aews_official_rc_1.2.09/platforms/android/gradlew cdvBuildDebug -b /opt/Ion icProjects/aews_official_rc_1.2.09/platforms/android/build.gradle -Dorg.gradle.daemon=true -Dorg.gradle.jvmargs=-Xmx2048m -Pandroid.useDeprecatedNdk=true
Error: spawn EACCES

build.gradle in platorms/android
gradlew in platforns/android

There is Android Studio 3.0.1
Android Studio 3.0.1
SDK Platforms (SDK Location shown for .profile)
SDK Tools
SDK Update Sites
Path to Gradle inside Android Studio package contents

My .profile (loose from this) contains:

export JAVA_HOME=$(/usr/libexec/java_home)
export ANDROID_HOME=~/Library/Android/sdk
#ANDROID_HOME=/opt/android-sdk
export NVM_DIR="$HOME/.nvm"
export PATH=${JAVA_HOME}/bin: ${PATH}
export PATH=${ANDROID_HOME}/platform-tools:${PATH}
export PATH=${ANDROID_HOME}/tools:${PATH}
export PATH=$ {ANDROID_HOME}/tools/bin:${PATH}
#${ANDROID_HOME}/tools/bin:${HOME}/bin:.
export GRADLE_HOME="/Applications/Android Studio.app/ Contents/gradle/gradle-4.1"
export PATH=${PATH}:${GRADLE_HOME}/bin

This is the only other idea I have at this time.. In Android Studio Space.
This may mess up the path, so I tend to copy it out.

Which gradle will generate the correct path…

 /Applications/Android Studio.app/Contents/gradle/gradle-4.1/bin/gradle

(I have uninstalled the old brew version before, but pointing to the Android Studio version with the path does not seem to make any difference ).

The last footnote… At that time, android was a command that could be used for both the sdk and apk manager functions. You used to have to do something like accepting license terms or similar.
No What is more like I am missing here?
It’s just that I’m grabbing my choice.

After SurajRao’s prompt, run cordova to build android –verbose,

I am now solving the original problem.

This is done by doing this:

cd /platform/android/
chmod +x build.gradle
chmod +x gradlew

It now produces:

Error: /opt/IonicProjects/aews_official_rc_1.2.09/platforms/android/gradlew: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project':CordovaLib'.
> Could not resolve all files for configuration':CordovaLib:classpath'.
> Could not resolve org.bouncycastle:bcprov-jdk15on:1.48.
Required by:
project :CordovaLib> com.android. tools.build:gradle:2.2.3> com.android.tools.build:gradle-core:2.2.3> com.android.tools.build:builder:2.2.3
project :CordovaLib> com.android .tools.build:gradle:2.2.3> com.android.tools.build:gradle-core:2.2.3> com.android.tools.build:builder:2.2.3> com.a ndroid.tools:sdk-common:25.2.3
project :CordovaLib> com.android.tools.build:gradle:2.2.3> com.android.tools.build:gradle-core:2.2.3> com .android.tools.build:builder:2.2.3> org.bouncycastle:bcpkix-jdk15on:1.48
> Could not resolve org.bouncycastle:bcprov-jdk15on:1.48.
> Could not get resource ' https://jcenter.bintray.com/org/bouncycastle/bcprov-jdk15on/1.48/bcprov-jdk15on-1.48.pom'.
> Could not HEAD'https://jcenter.bintray.com/org/ bouncycastle/bcprov-jdk15on/1.48/bcprov-jdk15on-1.48.pom'. Received status code 502 from server: Bad Gateway

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug optionto get more log output.

* Get more help at https://help.gradle.org

Try gradle init here… and this seems to solve it.

I found that using the –verbose flag and The cordova command instead of the ionic command provides debugging information during the cordova build process.

cordova build an droid --verbose

Edit –> I used Ionic here to make a detailed Github request, it should be fixed for Ionic Cli 4.

According to your log,

p>

Running command: /opt/IonicProjects/aews_official_rc_1.2.09/platforms/android/gradlew cdvBuildDebug -b /opt/IonicProjects/aews_official_rc_1.2.09/platforms/android/build.gradle -Dorg .gradle.daemon=true -Dorg.gradle.jvmargs=-Xmx2048m -Pandroid.useDeprecatedNdk=true

It is your problem.

You must provide executable permissions

/opt/IonicProjects/aews_official_rc_1.2.09/platforms/android/build.gradle

and

/opt /IonicProjects/aews_official_rc_1.2.09/platforms/android/gradlew

Use chmod x

I have seen many references through chmod, (x or 755 ) Change the execution properties of gradle… these seem to make no difference.
Even if I run, I still get the message:
sudo ion cordova build android

I have these settings:

p>

The only thing I can think of is that there is no execution attribute in the hook of the plug-in…

Plugins-no custom hooks folder entries

sudo ion cordova build android

....
> cordova build a ndroid
ANDROID_HOME=/Users/jgf/Library/Android/sdk
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home
Subproject Path: CordovaLib
Error: spawn EACCES

[ERROR] An error occurred while running cordova build android (exit code 1).

One of the most annoying things about this error is It does not give you enough details and hides the root cause of the problem…
I have tried adding things like the –verbose and –release flags, but nothing has changed in terms of solving the problem.

Run Mac OS X High Sierra 10.13.2

ionic information

cli packages: (/Users/jgf/.nvm/versions/node/v8 .9.3/lib/node_modules)

@ionic/cli-utils: 1.18.0
ionic (Ionic CLI): 3.18.0

global packages:< br />
cordova (Cordova CLI): 7.0.1

local packages:

@ionic/app-scripts: 3.1.5
Cordova Platforms: android 6.4.0 browser 4.1.0 ios 4.4.0
Ionic Framework: ionic-angular 3.9.2

System:

Android SDK Tools: 26.1 .1
Node: v8.9.3
npm: 5.6.0
OS: macOS High Sierra
Xcode: Xcode 9.2 Build version 9C40b

Environment Variables:

ANDROID_HOME: /Users/jgf/Library/Android/sdk

Misc:

backend: legacy

cordova platform version

Installed platforms:
android 6.4.0
browser 4.1.0
ios 4.4.0
Available platforms:
blackberry10 ~3.8.0 (deprecated)
osx ~4.0.1
webos ~3.7.0

cordova build android –verbose

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 config.xml for saved p lugins 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 /opt/IonicProjects/aews_official_rc_1.2.09/platforms/android/res/xml/config.xml
Merging project's config.xml into platform- specific android config.xml
Merging and updating files from [www, platforms/android/platform_www] to platforms/android/assets/www
Wrote out android application name "ET-Mobile" to /opt/IonicProjects /aews_official_rc_1.2.09/platforms/android/res/values/strings.xml
android-versionCode not found in config.xml. Generating a code based on version in config.xml (0.0.1): 1
Wrote out Android package name "com.extratechnology.etmobile" to /opt/IonicProjects/aews_official_rc_1.2.09/platforms/android/src/com/extratechnology/etmob ile/MainActivity.java
Updating icons at platforms/android/res
Updating splash screens at platforms/android/res
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".
ANDROID_HOME=/Users/jgf/Library/Android/sdk
JAVA_HOME=/ Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home
Subproject Path: CordovaLib
Running command: /opt/IonicProjects/aews_official_rc_1.2.09/platforms/android/gradlew cdvBuildDebug -b /opt /IonicProjects/aews_official_rc_1.2.09/platforms/android/build.gradle -Dorg.gradle.daemon=true -Dorg.gradle.jvmargs=-Xmx2048m -Pandroid.useDeprecatedNdk=true
Error: spawn EACCES

< p>build.gradle in platorms/android
gradlew in platforns /android

There is Android Studio 3.0.1
Android Studio 3.0.1
SDK Platforms (SDK Location shown for .profile)
SDK Tools
SDK Update Sites
Path to Gradle inside Android Studio package contents

< p>My .profile (loose from this) contains:

export JAVA_HOME=$(/usr/libexec/java_home)
export ANDROID_HOME=~/Library/ Android/sdk
#ANDROID_HOME=/opt/android-sdk
export NVM_DIR="$HOME/.nvm"
export PATH=${JAVA_HOME}/bin:${PATH}
export PATH=${ANDROID_HOME}/platform-tools:${PATH}
export PATH=${ANDROID_HOME}/tools:${PATH}
export PATH=${ANDROID_HOME}/tools/ bin:${PAT H}
#${ANDROID_HOME}/tools/bin:${HOME}/bin:.
export GRADLE_HOME="/Applications/Android Studio.app/Contents/gradle/gradle-4.1"
export PATH=${PATH}:${GRADLE_HOME}/bin

This is the only other idea I have at this time.. Space in Android Studio.
This may mess up Path, so I tend to copy it out.

Which gradle will generate the correct path…

/Applications/Android Studio.app/Contents/ gradle/gradle-4.1/bin/gradle

(I have uninstalled the old brew version before, but pointing to the Android Studio version with the path does not seem to make any difference).

Finally A footnote…At that time, android was a command that could be used for both the sdk and apk manager functions, you used to have to do something like accepting the license terms or something like that.
There is nothing more like this I don’t see here either NS?
It’s just that I’m grabbing my choice.

After SurajRao’s prompt, run cordova to build android –verbose,

I am now solving the original problem.

This is done by doing this:

cd /platform/android/
chmod +x build.gradle
chmod +x gradlew

It now produces:

Error: /opt/IonicProjects/aews_official_rc_1.2.09/platforms/android/gradlew: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project':CordovaLib'.
> Could not resolve all files for configuration':CordovaLib:classpath'.
> Could not resolve org.bouncycastle:bcprov-jdk15on:1.48.
Required by:
project :CordovaLib> com.android. tools.build:gradle:2.2.3> com.android.tools.build:gradle-core:2.2.3> com.android.tools.build:builder:2.2.3
project :CordovaLib> com.android .tools.build:gradle:2.2.3> com.android.tools.build:gradle-core:2.2.3> com.android.tools.build:builder:2.2.3> com.android.t ools:sdk-common:25.2.3
project :CordovaLib> com.android.tools.build:gradle:2.2.3> com.android.tools.build:gradle-core:2.2.3> com.android .tools.build:builder:2.2.3> org.bouncycastle:bcpkix-jdk15on:1.48
> Could not resolve org.bouncycastle:bcprov-jdk15on:1.48.
> Could not get resource'https: //jcenter.bintray.com/org/bouncycastle/bcprov-jdk15on/1.48/bcprov-jdk15on-1.48.pom'.
> Could not HEAD'https://jcenter.bintray.com/org/bouncycastle/ bcprov-jdk15on/1.48/bcprov-jdk15on-1.48.pom'. Received status code 502 from server: Bad Gateway

* Try:
Run with --stacktrace option to get the stack trace . Run with --info or --debug optionto get more log output.

* Get more help at https://help.gradle.org

Will try as suggested here gradle init …and this seems to solve it.

I found that using the –verbose flag and cordova command directly instead of the ionic command provides debugging during the cordova build process Information.

cordova build android --verbose

Edit –> I used Ionic here to make a detailed Github request, it should It is fixed for Ionic Cli 4.

According to your log,

Running command: /opt/IonicProjects/aews_official_rc_1.2.09/platforms/android /gradlew cdvBuildDebug -b /opt/IonicProjects/aews_official_rc_1.2.09/platforms/android/build.gradle -Dorg.gradle.daemon=true -Dorg.gradle.jvmargs=-Xmx2048m -Pandroid.useDeprecatedNdk=true

It’s your problem.

You must provide executable permissions

/opt/IonicProjects/aews_official_rc_1.2.09/platforms/android/build.gradle< /pre> 

and

/opt/IonicProjects/aews_official_rc_1.2.09/platforms/android/gradlew

Use chmod x

< /p>

Leave a Comment

Your email address will not be published.