Unknown Android Studio 3.0 <library> element found

After updating Android Studio, one of my projects could not be created. Error message:

Error:(20) error: unknown element <library> found. Error:(20) unknown element <library> found. Error:java.util.concurrent.ExecutionException: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details Error:java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details Error:com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details Error:Execution failed for task ':app:processDebugResources'. > Failed to execute aapt 

My SDK version is 25. I tried to invalidate the cache and add distributionUrl=https://services.gradle.org/distributions/gradle-4.1-rc-2-all.zip and both of them do not work for me.

Here are my dependencies:

 dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { exclude group: 'com.android.support', module: 'support-annotations' }) compile 'com.android.support:appcompat-v7:25.4.0' compile 'com.android.support.constraint:constraint-layout:1.0.2' compile 'com.android.support:support-v4:25.4.0' compile 'de.hdodenhof:circleimageview:2.2.0' testCompile 'junit:junit:4.12' annotationProcessor "com.github.Raizlabs.DBFlow:dbflow-processor:${dbflow_version}" compile "com.github.Raizlabs.DBFlow:dbflow-core:${dbflow_version}" compile "com.github.Raizlabs.DBFlow:dbflow:${dbflow_version}" compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.android.support:appcompat-v7:25.4.0' compile 'com.android.support:design:25.4.0' compile 'com.microsoft.projectoxford:face:1.3.0' } 

This is the error log after removing DBFlow:

 Error:(20) error: unknown element <library> found. Error:(20) unknown element <library> found. Error:java.util.concurrent.ExecutionException: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details Error:java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details Error:com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details Error:Execution failed for task ':app:processDebugResources'. > Failed to execute aapt 
+8
source share
6 answers

Add this code to gradle.properties in the root project:

 android.enableAapt2=false 

enter image description here

+11
source

In Android Studio version 3.1.2 solution

 android.enableAapt2=false 

does not work any more.

The root cause of this problem is the MERGE manifest, which occurs when you try to include other dependencies in your project.

To check the error

  1. Open AndroidManifest.xml

  2. At the bottom of the window, select the " Combined manifest" tab.

  3. Browse through the manifest file now and check the part of the manifest that is on a slightly red background, or look for the library tag.

  4. Right-click and select " Go to ad . " Check the file and check which library / dependency it belongs to.

  5. Either delete this library or update it from the repository.

Hope this helps.

+7
source

This is a reported issue on Github . The problem in projectoxford seems to be fixed already on v.1.0.395

+1
source

Try removing the annotation processor that you added to this line annotationProcessor "com.github.Raizlabs.DBFlow:dbflow-processor:${dbflow_version}" if you used any other file that also

Like studio 3.0, they have a built-in annotation processor

0
source

You just need to add this to your Android manifest

 <library tools:node="removeAll" /> 

Hope it helps :)

0
source

Is a patched version of the SDK available? I tried version v.1.0.395 but with the same problem.

0
source

Source: https://habr.com/ru/post/1273065/


All Articles