cordova-android编译报错

16

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ‘:app:mergeReleaseResources’.

java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2InternalException: AAPT2 aapt2-3.3.0-5013011-windows Daemon #1: Unexpected error during compile ‘E:\Git\blinker-app\platforms\android\app\src\main\res\drawable-port-xxxhdpi\screen.png’, attempting to stop daemon.
This should not happen under normal circumstances, please file an issue if it does.

  • Try: FAILED
    20 actionable tasks: 18 executed, 2 up-to-date

Run with –stacktrace option to get the stack trace. Run with –info or –debug option to get more log output. Run with –scan to get full insights.

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

BUILD FAILED in 3s
Exception in thread “ForkJoinPool.commonPool-worker-13” java.lang.IllegalStateException: AAPT Process manager cannot be shut down while daemons are in use
at com.android.builder.internal.aapt.v2.Aapt2DaemonManager.shutdown(Aapt2DaemonManager.kt:96)
at com.android.build.gradle.internal.res.namespaced.RegisteredAaptService.shutdown(Aapt2DaemonManagerService.kt:61)
at com.android.build.gradle.internal.workeractions.WorkerActionServiceRegistry$shutdownAllRegisteredServices$1$1.run(WorkerActionServiceRegistry.kt:96)
at java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1402)
at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
E:\Git\blinker-app\platforms\android\gradlew: Command failed with exit code 1 Error output:
ע: E:\Git\blinker-app\platforms\android\CordovaLib\src\org\apache\cordova\engine\SystemCookieManager.javaʹ�û򸲸����ѹ�ʱ�� API��
ע: �й���ϸ��Ϣ, ��ʹ�� -Xlint:deprecation ���±��롣

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ‘:app:mergeReleaseResources’.

java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2InternalException: AAPT2 aapt2-3.3.0-5013011-windows Daemon #1: Unexpected error during compile ‘E:\Git\blinker-app\platforms\android\app\src\main\res\drawable-port-xxxhdpi\screen.png’, attempting to stop daemon.
This should not happen under normal circumstances, please file an issue if it does.

  • Try:
    Run with –stacktrace option to get the stack trace. Run with –info or –debug option to get more log output. Run with –scan to get full insights.
  • Get more help at https://help.gradle.org

BUILD FAILED in 3s
Exception in thread “ForkJoinPool.commonPool-worker-13” java.lang.IllegalStateException: AAPT Process manager cannot be shut down while daemons are in use
at com.android.builder.internal.aapt.v2.Aapt2DaemonManager.shutdown(Aapt2DaemonManager.kt:96)
at com.android.build.gradle.internal.res.namespaced.RegisteredAaptService.shutdown(Aapt2DaemonManagerService.kt:61)
at com.android.build.gradle.internal.workeractions.WorkerActionServiceRegistry$shutdownAllRegisteredServices$1$1.run(WorkerActionServiceRegistry.kt:96)
at java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1402)
at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
[ERROR] An error occurred while running subprocess cordova.

    cordova.cmd build android --release exited with exit code 1.

    Re-running this command with the --verbose flag may provide more information.

一个解释:

java – com.android.builder.internal.aapt.v2.Aapt2InternalException – Stack Overflow

简单说就是gradle插件的bug,新版本已经修复。注意gradle插件不是gradle,其版本对应关系见:

Android Gradle 插件版本说明  |  Android 开发者  |  Android Developers (google.cn)

修改android项目下的build.gradle可以指定gradle插件版本

classpath 'com.android.tools.build:gradle:3.3.3'

留下一个答复

Please enter your comment!
Please enter your name here