com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource compilation failed after updating android studio

后端 未结 10 1544
清歌不尽
清歌不尽 2021-02-04 08:29

After updating android studio,i am getting this error.how to fix this??

org.gradle.execution.MultipleBuildFailures: Build completed with 1 failures.
    at         


        
相关标签:
10条回答
  • 2021-02-04 09:13

    In my case it was on color.xml in which invalid color name found and it did produce following error

     java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource compilation failed
    

    I checked the logcat error and I found this line of stack trace

     C:\\MyProjectPath\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml
    

    Then I had a look into it and I found my color code was wrong then I fixed it and it compiled well.

    0 讨论(0)
  • 2021-02-04 09:14

    Fix this one:

    Nexge_Talk_New_UI/app/src/main/res/values/ids.xml:3:5-50: AAPT: error: <item> inner element must either be a resource reference or empty.
    
    0 讨论(0)
  • 2021-02-04 09:25

    error in my application; Compiler SDK for one of the libraries was giving an error because it was Version = 27.

    The problem was solved when I edited Compiler SDK Version = 28 for all libraries.

    0 讨论(0)
  • 2021-02-04 09:25

    I migrated to AndroidX by selecting following in Android Studio Menu options

    Refactor -> Migrate to AndroidX

    Later I faced this AAPT issue, Linker issue etc. I fixed it by the following changes

    In all modules I have updated compileSdkVersion 28

    Still if you are facing issue then clean project and rebuild project. In all modules all classes imports are from the support libraries and used other version libraries excepet AndroidX. Just delete those imports then automatically AndroidX will import those components.

    Click on File -> Settings -> Build,Execution,Deployment -> Compiler 
    

    In that command line option I mentioned as --stacktrace for the details log when you build project.

    In details, I came to know that few classes still having old imports which are not androidx migrated, so I checked imports for the all the classes.

    --Vinod

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