Exception : AAPT2 error: check logs for details

前端 未结 23 1600
走了就别回头了
走了就别回头了 2020-11-27 14:00
Task :processDebugResources Failed to execute aapt com.android.ide.common.process.ProcessException: Failed to execute aapt
    at com.android.builder.core.AndroidBui         


        
相关标签:
23条回答
  • 2020-11-27 14:40

    For me, I got this error while working on some Udacity projects. I fixed it by adding the following code to the top-level build.gradle file.

    allprojects {
        String osName = System.getProperty("os.name").toLowerCase()
        if (osName.contains("windows")) {
            buildDir = "C:/tmp/${rootProject.name}/${project.name}"
        }
        repositories {
            jcenter()
            google()
        }
    }
    
    0 讨论(0)
  • 2020-11-27 14:40

    If you are seeking a way to get to the heart of the issue. Android studio contains a feature within the edit configurations panel that simplifies this possible. By clicking on the "app" tag (It is typically to the left of the top run button)

    You will open the option to edit configurations. From there create an instance of the gradle option to yourself.

    The core features are actually the gradle project as well as the task. Connect the task to your debug initiative.

    When you run your app through this setting, Android will spit out detailed errors(That we all wish would appear more often) and these errros will point directly a what needs to be resolved.

    0 讨论(0)
  • 2020-11-27 14:41

    Just in case above solution did not work. In my case , Bitdefender Antivirus was Preventing AAPT2 from making change on certain file.

    0 讨论(0)
  • 2020-11-27 14:42

    You have a problem with a png file maybe, look here :

    1 more Caused by: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details at com.android.builder.png.AaptProcess$NotifierProcessOutput.handleOutput(AaptProcess.java:454)

    It can be corrupted image or jpeg image with png extension

    0 讨论(0)
  • 2020-11-27 14:45

    some symbols should be transferred like '%'

    <string name="test" formatted="false">95%</string>
    
    0 讨论(0)
  • 2020-11-27 14:46

    The error might be cause by non-ASCII symbols in gradle path. E.g. cyrillic symbols of the user folder. So, the problem is solved just by switching to another directory with ASCII-only path.

    0 讨论(0)
提交回复
热议问题