Build android gets spawn EACCES error


#1

The command 'ionic cordova platform add android" is always successful, but the build always fails with the following error:

Running command: …/hooks/after_prepare/010_add_platform_class.js
Running command: …/hooks/after_prepare/020_add_android_push_icon.js

ANDROID_HOME=/Users/username/Library/Android/sdk/
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_151.jdk/Contents/Home
Error: spawn EACCES

I already tried to change the permissions for the contents of the hooks/ dir with

chmod -R 0777 hooks

I have read that it could help to run the command

ionic hooks add

but that command is not defined in my ionic project. Another thing I tried is to update my Android Studio.
The building of the iOS platform is running without errors.

Here the ‘ionic info’:
[WARN] Error with ./www/lib/ionic/version.json file: FILE_NOT_FOUND, trying ./bower.json.

cli packages: (/Users/patriciaroth/.nvm/versions/node/v6.9.2/lib/node_modules)

_ @ionic/cli-utils : 1.19.0_
_ ionic (Ionic CLI) : 3.19.0_

global packages:

_ cordova (Cordova CLI) : 7.1.0_
_ Gulp CLI : CLI version 3.9.1 Local version 3.9.1_

local packages:

_ Cordova Platforms : android 6.3.0 ios 4.4.0_
_ Ionic Framework : ionic1 1.3.1_

System:

_ Android SDK Tools : 25.2.3_
_ ios-deploy : 1.9.1_
_ ios-sim : 6.0.0_
_ Node : v6.9.2_
_ npm : 3.10.9_
_ OS : macOS Sierra_
_ Xcode : Xcode 9.2 Build version 9C40b_

Environment Variables:

_ ANDROID_HOME : /Users/username/Library/Android/sdk/_

Misc:

_ backend : pro_

Can someone help me out?


#2

Install cordova-android 6.4.0.
Run ionic info cordova requirements and post its output.
Run the same command again as above, but add --verbose at the end.


#3

Verbose output while installing cordova-android 6.4.0:

[DEBUG] Reason for not using local CLI: LOCAL_CLI_NOT_FOUND
[DEBUG] CLI flags: { interactive: true, confirm: false }
[DEBUG] { cwd: ‘/Users/username/app/appName’, local: false, binPath:
’/Users/username/.nvm/versions/node/v6.9.2/lib/node_modules/ionic/bin/ionic’, libPath:
’/Users/username/.nvm/versions/node/v6.9.2/lib/node_modules/ionic/dist/index.js’ }
[DEBUG] Daemon found (pid: 2089)

cordova platform add android@6.4.0 --save
Using cordova-fetch for cordova-android@6.4.0

Adding android project…

Creating Cordova project for the Android platform:

Path: platforms/android
Package: com.appName.app
Name: appName
Activity: MainActivity
Android target: android-26
Subproject Path: CordovaLib
Android project created with cordova-android@6.4.0

Installing “com-sarriaroman-photoviewer” for android

Subproject Path: CordovaLib
Installing “com.cmackay.plugins.googleanalytics” for android

Subproject Path: CordovaLib
Installing “com.googlemaps.ios” for android

Installing “cordova-plugin-actionsheet” for android

Installing “cordova-plugin-add-swift-support” for android

Installing “cordova-plugin-app-version” for android

Installing “cordova-plugin-camera” for android
Subproject Path: CordovaLib
Installing “cordova-plugin-console” for android

Installing “cordova-plugin-customurlscheme” for android

Installing “cordova-plugin-datepicker” for android
Installing “cordova-plugin-device” for android

Installing “cordova-plugin-dialogs” for android
Installing “cordova-plugin-file” for android

The Android Persistent storage location now defaults to “Internal”. Please check this plugin’s README to see if your application needs any changes in its config.xml.

If this is a new application no changes are required.

If this is an update to an existing application that did not specify an “AndroidPersistentFileLocation” you may need to add:

  "<preference name="AndroidPersistentFileLocation" value="Compatibility" />"

to config.xml in order for the application to find previously stored files.

Installing “cordova-plugin-file-transfer” for android

Plugin dependency “cordova-plugin-file@5.0.0” already fetched, using that version.

Dependent plugin “cordova-plugin-file” already installed on android.

Installing “cordova-plugin-geolocation” for android

Installing “cordova-plugin-globalization” for android

Installing “cordova-plugin-googlemaps” for android

Subproject Path: CordovaLib

        Official document
        https://github.com/mapsplugin/cordova-plugin-googlemaps-doc/blob/master/v2.0.0/README.md

Installing “cordova-plugin-inappbrowser” for android

Installing “cordova-plugin-ionic” for android
Plugin dependency “cordova-plugin-add-swift-support@1.7.0” already fetched, using that version.

Dependent plugin “cordova-plugin-add-swift-support” already installed on android.

Plugin dependency “cordova-plugin-splashscreen@4.0.3” already fetched, using that version.

Installing “cordova-plugin-splashscreen” for android

Installing “cordova-plugin-ionic-webview” for android

Installing “cordova-plugin-mauron85-background-geolocation” for android

Subproject Path: CordovaLib
Installing “cordova-plugin-network-information” for android

Plugin “cordova-plugin-splashscreen” already installed on android. Making it top-level.
Installing “cordova-plugin-statusbar” for android
Installing “cordova-plugin-whitelist” for android

           This plugin is only applicable for versions of cordova-android greater than 4.0. If you have a previous platform version, you do *not* need this plugin since the whitelist will be built in.

Installing “cordova-plugin-x-toast” for android

Installing “cordova.plugins.diagnostic” for android

Subproject Path: CordovaLib
Installing “ionic-plugin-keyboard” for android

Installing “phonegap-plugin-push” for android

Subproject Path: CordovaLib
Running command: /Users/username/app/appName/hooks/after_prepare/010_add_platform_class.js /Users/username/app/appName

Running command: /Users/username/app/appName/hooks/after_prepare/020_add_android_push_icon.js /Users/username/app/appName
–save flag or autosave detected

Saving android@~6.4.0 into config.xml file …

The verbose output from building android:

Running command: /Users/usernane/app/appName/hooks/after_prepare/010_add_platform_class.js /Users/usernane/app/appName

Running command: /Users/usernane/app/appName/hooks/after_prepare/020_add_android_push_icon.js /Users/usernane/app/appName
ANDROID_HOME=/Users/username/Library/Android/sdk/
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_151.jdk/Contents/Home
:wrapper

BUILD SUCCESSFUL
in 1s
1 actionable task: 1 executed
Subproject Path: CordovaLib
Configuration ‘compile’ in project ‘:’ is deprecated. Use ‘implementation’ instead.
The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Action) instead.

at build_cywzfxzd4z699682lk3od5532.run(/Users/patriciaroth/mila/oasis-app/platforms/android/build.gradle:144)

publishNonDefault is deprecated and has no effect anymore. All variants are now published.
:preBuild UP-TO-DATE
:CordovaLib:preBuild UP-TO-DATE

:CordovaLib:preDebugBuild

UP-TO-DATE
:CordovaLib:checkDebugManifest

:CordovaLib:processDebugManifest

:preDebugBuild

:CordovaLib:compileDebugAidl

:compileDebugAidl

:CordovaLib:packageDebugRenderscript

NO-SOURCE
:compileDebugRenderscript

:checkDebugManifest
:generateDebugBuildConfig
:prepareLintJar
:generateDebugResValues
:generateDebugResources
:CordovaLib:compileDebugRenderscript

:CordovaLib:generateDebugResValues

:CordovaLib:generateDebugResources
:CordovaLib:packageDebugResources
:mergeDebugResources

:createDebugCompatibleScreenManifests

:processDebugManifest

:splitsDiscoveryTaskDebug

:CordovaLib:platformAttrExtractor

:CordovaLib:generateDebugBuildConfig
:CordovaLib:prepareLintJar
:CordovaLib:javaPreCompileDebug

:CordovaLib:processDebugJavaRes NO-SOURCE
:compileDebugNdk NO-SOURCE
:mergeDebugShaders
:compileDebugShaders
:generateDebugAssets
:CordovaLib:mergeDebugShaders
:CordovaLib:compileDebugShaders
:CordovaLib:generateDebugAssets
:CordovaLib:mergeDebugAssets
:mergeDebugAssets

:mergeDebugJniLibFolders

:CordovaLib:compileDebugNdk NO-SOURCE
:CordovaLib:mergeDebugJniLibFolders

:CordovaLib:transformNativeLibsWithMergeJniLibsForDebug

:CordovaLib:transformNativeLibsWithIntermediateJniLibsForDebug
:processDebugJavaRes NO-SOURCE
:validateSigningDebug
:CordovaLib:processDebugResources

:processDebugResources

:generateDebugSources
:CordovaLib:generateDebugSources
:CordovaLib:compileDebugJavaWithJavac
Note: Some input files use or override a deprecated API.

Note: Recompile with -Xlint:deprecation for details.

:CordovaLib:transformClassesAndResourcesWithPrepareIntermediateJarsForDebug

:javaPreCompileDebug

:compileDebugJavaWithJavac
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.

:compileDebugSources
:transformClassesWithDexBuilderForDebug

:transformDexArchiveWithExternalLibsDexMergerForDebug

:transformDexArchiveWithDexMergerForDebug

:transformNativeLibsWithMergeJniLibsForDebug

:transformResourcesWithMergeJavaResForDebug

:packageDebug

:assembleDebug
:cdvBuildDebug

BUILD SUCCESSFUL in 17s
44 actionable tasks: 44 executed
Built the following apk(s):
/Users/usernane/app/appName/platforms/android/build/outputs/apk/debug/android-debug.apk

The cordova requirements check says:

Requirements check results for android:

Java JDK: installed 1.8.0
Android SDK: installed true
Android target: not installed
android: Command failed with exit code ENOENT

Gradle: installed /usr/local/Cellar/gradle/4.4/bin/gradle

Requirements check results for ios:
Apple OS X: installed darwin
Xcode: installed 9.2

ios-deploy: installed 1.9.1

CocoaPods: installed
Error: Some of requirements check failed

With the cordova-android 6.4.0 is was now able to build successfully. But in the new Ionic View app I’m still not able to run my current build because of a cordova copying files error.


#4

Does this have to do anything with this topic?
If not, please open a new one.