Ionic (+cordova,android.sdk,gradlew) Execution failed for task <task_name>

徘徊边缘 提交于 2019-12-12 03:16:46

问题


(my problem was related to ionic, and it is common problem here, it is caused by using cordova and android.sdk, so I am adding these flags too)

I had problem running [ionic run android [-lc], ionic build android] (if you got it in ios or other commands, and it is solved by this answer - comment please)

Execution failed for task ':processDebugResources'. com.android.ide.common.process.ProcessException:
org.gradle.process.internal.ExecException: Process 'command 'C:\Android_SDK\build-tools\24.0.1\aapt.exe'' finished with non-zero exit value

To be honest, you can call it

Execution failed for task . com.android.ide.common.process.ProcessException:
org.gradle.process.internal.ExecException: Process 'command 'C:\Android_SDK\build-tools\24.0.1\aapt.exe'' finished with non-zero exit


回答1:


At the start you can try other, faster fixes:

  • Execution failed for task :processDebugResources [ Cordova / Ionic ] (actually it covers answer to mine, but there is lack of debugging and fixing deeper problems)

  • ionic build android failure - Execution failed for task processDebugResources

  • Error:Execution failed for task , finished with non-zero exit value 1

Try to update cordova (and Ionic)

If you aren't using the ionic, remove ionic from command.

npm update cordova ionic or if it is globally npm update -g cordova ionic

How to debug it:

Try to find the gradlew. (for Windows) gradlew.bat, (for Unix'ies) gradlew (dot something I guess - comment me please)

Ionic (Windows): project_name/platforms/platform(android)/gradlew.bat (example: C:\workspace\Caparol\platforms\android\gradlew.bat)

Other system/framework? Add an edit/comment.

(I am using the git bash, I am not sure if that works in pure cmd on Windows, it should work in any Unix terminal)

Go to the platform_name directory, that contains your gradlew file.

Process ./gradlew_file assembleDebug --info (example ./gradlew.bat assembleDebug --info) or/and ./gradlew_file --info build clean (example ./gradlew.bat --info build clean)

In output you got more detailed information than using --stack-trace or --info or --debug in usual build command.

Invalid path

C:\workspace\project_name\platforms\android\build\intermediates\assets\debug\www\dir\Zdj▒cia: error: Invalid directory name, unable to add.

And fix not valid characters in path - dont use national characters.

Then - fix it in your project and build/intermediates folder. (or delete build/intermediates)

Lint error

You can get problems like

Execution failed for task ':CordovaLib:lint'. Lint found errors in the project; aborting build.

for example I got:

Execution failed for task ':CordovaLib:lint'.

android {
  lintOptions {
    abortOnError false
  }
}

Fix it to valid file_type syntax.

More cases? Comment me please.



来源:https://stackoverflow.com/questions/39181901/ionic-cordova-android-sdk-gradlew-execution-failed-for-task-task-name

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!