gpt4 book ai didi

android - Android Studio 3.0.1新项目:AAPT2执行异常

转载 作者:行者123 更新时间:2023-12-03 05:10:25 24 4
gpt4 key购买 nike

我在Android Studio 3.0.1中创建了一个新项目,在构建过程中,我遇到了aapt2异常。禁用aapt2是一种选择,但是我想了解为什么aapt2无法构建。

让我知道是否需要其他详细信息

Gradle控制台输出:

失败:生成失败,发生异常。

  • 出了什么问题:
    任务':app:mergeDebugResources'的执行失败。

    Error: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details

  • 尝试:
    使用--stacktrace选项运行以获取堆栈跟踪。使用--info或--debug选项运行,以获取更多日志输出。
  • https://help.gradle.org上获得更多帮助

  • 1秒内失败

    带有--info标志的控制台输出:
    AAPT warning(1028621614), Job(QueuedJob{
    title=Compiling values.xml,
    task={from=C:\Users\svssrinivas\AndroidStudioProjects\Learn\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml, to=C:\Users\svssrinivas\AndroidStudioProjects\Learn\app\build\intermediates\res\merged\debug},
    future=com.google.common.util.concurrent.SettableFuture@7d83ce1d}): Done
    Exception while processing job : QueuedJob{
    title=Compiling values.xml,
    task={from=C:\Users\svssrinivas\AndroidStudioProjects\Learn\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml, to=C:\Users\svssrinivas\AndroidStudioProjects\Learn\app\build\intermediates\res\merged\debug},
    future=com.google.common.util.concurrent.SettableFuture@7d83ce1d} : com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
    Process (412248382) processed 0 files
    Thread(queued-resource-processor_54): Process(412248382), after shutdown queue_size=2
    Slave 1566465306 is ready
    Process (197581388) processed 0 files
    Thread(queued-resource-processor_55): Process(197581388), after shutdown queue_size=2
    Process (1933852165) processed 1 files
    Thread(queued-resource-processor_53): Process(1933852165), after shutdown queue_size=1
    Process (1566465306) processed 0 files
    Thread(queued-resource-processor_56): Process(1566465306), after shutdown queue_size=0
    Shutdown finished in 9ms
    Error: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
    :app:mergeDebugResources FAILED
    :app:mergeDebugResources (Thread[Task worker for ':',5,main]) completed. Took 0.561 secs.

    FAILURE: Build failed with an exception.

    * What went wrong:
    Execution failed for task ':app:mergeDebugResources'.
    > Error: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details

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

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

    BUILD FAILED in 1s

    7 actionable tasks: 1 executed, 6 up-to-date

    编辑:

    全梯度输出:
    Executing tasks: [:app:assembleDebug]

    Configuration on demand is an incubating feature.
    Observed package id 'add-ons;addon-google_apis-google-19' in inconsistent location 'D:\AndroidSDK\add-ons\addon-google_apis-google-19-1' (Expected 'D:\AndroidSDK\add-ons\addon-google_apis-google-19')
    Observed package id 'add-ons;addon-google_apis-google-19' in inconsistent location 'D:\AndroidSDK\add-ons\addon-google_apis-google-19-1' (Expected 'D:\AndroidSDK\add-ons\addon-google_apis-google-19')
    :app:preBuild UP-TO-DATE
    :app:preDebugBuild UP-TO-DATE
    :app:compileDebugAidl UP-TO-DATE
    :app:compileDebugRenderscript UP-TO-DATE
    :app:checkDebugManifest UP-TO-DATE
    :app:generateDebugBuildConfig UP-TO-DATE
    :app:generateDebugResValues UP-TO-DATE
    :app:generateDebugResources UP-TO-DATE
    :app:mergeDebugResources
    values_values.arsc.flat: error: failed to open.


    Error: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
    :app:createDebugCompatibleScreenManifests
    :app:processDebugManifest
    :app:splitsDiscoveryTaskDebug
    :app:prepareLintJar UP-TO-DATE
    :app:compileDebugNdk NO-SOURCE
    :app:mergeDebugShaders
    :app:compileDebugShaders
    :app:generateDebugAssets
    :app:mergeDebugAssets
    :app:mergeDebugJniLibFolders
    :app:transformNativeLibsWithMergeJniLibsForDebug
    :app:transformNativeLibsWithStripDebugSymbolForDebug
    :app:processDebugJavaRes NO-SOURCE
    :app:validateSigningDebug
    :app:mergeDebugResources FAILED

    FAILURE: Build failed with an exception.

    * What went wrong:
    Execution failed for task ':app:mergeDebugResources'.
    > Error: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details

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

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

    BUILD FAILED in 24s

    18 actionable tasks: 11 executed, 7 up-to-date

    最佳答案

    简单的解决方案与文件夹权限有关。在大量研究了stacktrace输出并了解了有关Java异常的更多信息之后,我找到了答案。

    将您的Development / Project文件夹移动到可以对android studio / gradle进行写访问的位置。

    关于android - Android Studio 3.0.1新项目:AAPT2执行异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48426452/

    24 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com