执行任务:[clean,:app:assembleDebug]错误 - Android Studio 3

时间:2017-11-05 04:11:52

标签: android android-studio gradle android-gradle android-studio-2.3

我是android studio的新手。而我正在制作我的第一个应用程序,在之前的版本2.3中我没有问题或在制作应用程序时卡住了。但是当我升级到新版本3.0时,我遇到了问题,当我试图重建apk时。它停留在Executing tasks: [clean, :app:assembleDebug]。当我构建apk,重建和清理时,同样的问题。

任何人都可以帮忙解决这个问题吗?

我仍然无法解决这个问题。

10 actionable tasks: 9 executed, 1 up-to-date

Executing tasks: [clean, :app:assembleDebug]

    Parallel execution with configuration on demand is an incubating feature.
    :clean
    :app:clean
    :app:preBuild UP-TO-DATE
    :app:preDebugBuild
    :app:compileDebugAidl
    :app:compileDebugRenderscript
    :app:checkDebugManifest
    :app:generateDebugBuildConfig
    :app:prepareLintJar UP-TO-DATE
    :app:generateDebugResValues
    :app:generateDebugResources
    :app:mergeDebugResources
    Exception in thread "queued-resource-processor_4" java.lang.RuntimeException: Timed out while waiting for slave aapt process, make sure the aapt execute at C:\Users\kreuzell\AppData\Local\Android\Sdk\build-tools\26.0.2\aapt2.exe can run successfully (some anti-virus may block it) or try setting environment variable SLAVE_AAPT_TIMEOUT to a value bigger than 5 seconds
        at com.android.builder.png.AaptProcess.waitForReadyOrFail(AaptProcess.java:196)
        at com.android.builder.internal.aapt.AaptQueueThreadContext.creation(AaptQueueThreadContext.java:56)
        at com.android.builder.tasks.WorkQueue.run(WorkQueue.java:213)
        at java.lang.Thread.run(Thread.java:745)
    Exception in thread "queued-resource-processor_2" java.lang.RuntimeException: Timed out while waiting for slave aapt process, make sure the aapt execute at C:\Users\kreuzell\AppData\Local\Android\Sdk\build-tools\26.0.2\aapt2.exe can run successfully (some anti-virus may block it) or try setting environment variable SLAVE_AAPT_TIMEOUT to a value bigger than 5 seconds
        at com.android.builder.png.AaptProcess.waitForReadyOrFail(AaptProcess.java:196)
        at com.android.builder.internal.aapt.AaptQueueThreadContext.creation(AaptQueueThreadContext.java:56)
        at com.android.builder.tasks.WorkQueue.run(WorkQueue.java:213)
        at java.lang.Thread.run(Thread.java:745)
    Exception in thread "queued-resource-processor_1" java.lang.RuntimeException: Timed out while waiting for slave aapt process, make sure the aapt execute at C:\Users\kreuzell\AppData\Local\Android\Sdk\build-tools\26.0.2\aapt2.exe can run successfully (some anti-virus may block it) or try setting environment variable SLAVE_AAPT_TIMEOUT to a value bigger than 5 seconds
        at com.android.builder.png.AaptProcess.waitForReadyOrFail(AaptProcess.java:196)
        at com.android.builder.internal.aapt.AaptQueueThreadContext.creation(AaptQueueThreadContext.java:56)
        at com.android.builder.tasks.WorkQueue.run(WorkQueue.java:213)
        at java.lang.Thread.run(Thread.java:745)
    Exception in thread "queued-resource-processor_3" java.lang.RuntimeException: Timed out while waiting for slave aapt process, make sure the aapt execute at C:\Users\kreuzell\AppData\Local\Android\Sdk\build-tools\26.0.2\aapt2.exe can run successfully (some anti-virus may block it) or try setting environment variable SLAVE_AAPT_TIMEOUT to a value bigger than 5 seconds
        at com.android.builder.png.AaptProcess.waitForReadyOrFail(AaptProcess.java:196)
        at com.android.builder.internal.aapt.AaptQueueThreadContext.creation(AaptQueueThreadContext.java:56)
        at com.android.builder.tasks.WorkQueue.run(WorkQueue.java:213)
        at java.lang.Thread.run(Thread.java:745)

2 个答案:

答案 0 :(得分:1)

将它放在系统变量中:

SLAVE_AAPT_TIMEOUT = 30 

然后重新启动Windows,对我来说很漂亮。

答案 1 :(得分:0)

某些具有类似构建错误的Android Studio 3.0用户。

您的错误日志说:

Exception in thread "queued-resource-processor_4" java.lang.RuntimeException: Timed out while waiting for slave aapt process, make sure the aapt execute at C:\Users\kreuzell\AppData\Local\Android\Sdk\build-tools\26.0.2\aapt2.exe can run successfully **(some anti-virus may block it)** or try setting environment variable SLAVE_AAPT_TIMEOUT to a value bigger than 5 seconds

这意味着,如果您的互联网连接正常,您的 aapt进程可能会被您的防病毒或防火墙阻止。尝试停用防病毒并重新构建。

如果不起作用,您可以尝试禁用AAPT2:

  

使用AAPT2改进了增量资源处理,AAPT2默认启用。如果您在使用AAPT2时遇到问题,可以通过在 gradle.properties 文件中设置 android.enableAapt2 = false 并通过运行./gradlew重新启动Gradle守护程序来禁用它。 - 从命令行停止。