I am following google codelab for instant app. After I convert the original app to baseFeature and added another feature module which will then act like the application but will be based on the original baseFeature.
As per told in code lab, I changed the buld.gradle files and deleted the application component from the feature Module (Non Base module). When I try to build the project I get the follow error.
Error:(4) duplicate attribute
Error:/home/adventure/Desktop/android-topeka/topekaapk/build/intermediates/manifests/full/debug/AndroidManifest.xml:4 duplicate attribute
Error:java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.AaptException: AAPT2 link failed:
Error:com.android.builder.internal.aapt.AaptException: AAPT2 link failed:
Error:Execution failed for task ':topekaapk:processDebugResources'.
> Failed to execute aapt
I got stabbed in my back by lint , YES LINT
Problem : As shown in the image Lint gave an warning for optimizing the import and I removed the xmlns property from manifest.
Solution : Do not delete the xmlns property
Related
I am trying to build my project on android studio but I get this errors:
Execution failed for task ':launcher:mergeDebugJavaResource'.
A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
More than one file was found with OS independent path 'META-INF/facebook-core_release.kotlin_module'.
java.lang.RuntimeException: Manifest merger failed
Manifest merger failed
Duplicate class found
I also get a lot of erros on my AndroidManifest.xml that look like this one.
Class referenced in the manifest, com.facebook.unity.FBUnityDialogsActivity, was not found in the project or the libraries
Unresolved class 'FBUnityDialogsActivity'
I have tried all the solutions I could find on the internet and I also tried the suggestions android studio makes but none of them worked. The project is made with unity and I am just using android stuidio build the APK. Also some of the errors only occur after I implement Facebook SDK into my project.
I use Android Studio 3.1.4 and android gradle plugin version 3.1.4.
Previously I set buildToolsVersion "27.0.3" in build.gradle of module and there was no problem in building/running. Today I installed newer version of build tools and change build.gradle to use that: buildToolsVersion "28.0.2"
But when I try to sync project with gradle files or rebuild project it ends with AAPT2 error:
AGPBI: {"kind":"error","text":"error: \u003citem\u003e inner element must either be a resource reference or empty.","sources":[{"file":"<path to module>/src/main/res/values/ids.xml","position":{"startLine":16,"startColumn":4,"startOffset":752,"endColumn":55,"endOffset":803}}],"original":"","tool":"AAPT"}
....
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':<modulee-name>:mergeDebugResources'.
> Error: java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: AAPT2 error: check logs for details
But I do not understand what causes the error. For example addressed line in error is:
<item type="id" name="bookmark">false</item>
What causes this error and how I can solve this problem?
Edit
I added android.enableAapt2=false to the gradle.properties and it seems ignores error, but causes this warning:
The option 'android.enableAapt2' is deprecated and should not be used
anymore. Use 'android.enableAapt2=true' to remove this warning. It
will be removed at the end of 2018..
you cannot assign false (nor any other value but it's name) to an ID resource.
An ID is a simple resource that is referenced using the value provided in the name attribute (not the name of the XML file). As such, you can combine ID resources with other simple resources in the one XML file, under one element. Also, remember that an ID resources does not reference an actual resource item; it is simply a unique ID that you can attach to other resources or use as a unique integer in your application.
with android.enableAapt2=false it might ignore the logical error, but not "fix it".
When project is built with build:gradle:3.0.1, I've got this error.
AAPT2 error: check logs for details
I've tried solution
android.enableAapt2=false
in gradle.properties file
mentioned in this thread:
Error:com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
It works, but Java compiler gives warning,
WARNING: The option 'android.enableAapt2' is deprecated and should not be used anymore.
Can we resolve AAPT2 error without using android.enableAapt2=false ?
In my case, the error was beacause in the route where android studio was installed, i had a non-ASCII character (an accent to be more specific).
The most common case of this error is beacause the file manifest.xml have errors in it's structure.
Here is the structure it should have: https://developer.android.com/guide/topics/manifest/manifest-intro?hl=es-419
updated android studio to 3 and gradle to 3.0.0 beta getting following
error: Error:(792) attribute 'android:name' in tag
must be a valid Java class name
Error:com.android.builder.internal.aapt.AaptException: AAPT2 link
failed: Error:java.util.concurrent.ExecutionException:
com.android.builder.internal.aapt.AaptException: AAPT2 link failed:
Had this errors myself earlier and was able to fix by turning off AAP2 for this to work.
Go to your gradle.properties file and add this line to fix this error
android.enableAapt2=false.
Got this from a tweet by the Android Studio account.
After updating to Gradle 4.1 I'm unable to build my project (all works fine with previous releases).
Basically it doesn't recognize AndroidManifest tags anymore and gives me errors in the generated manifest in /build/intermediates/manifests/full/debug.
Here's the build log:
/home/paolorotolo/dev/exp/***/build/intermediates/manifests/full/debug/AndroidManifest.xml
Error:(30) unknown element <action> found
Error:(32) unknown element <category> found
Error:(33) unknown element <category> found
Error:/home/paolorotolo/dev/exp/core/***/build/intermediates/manifests/full/debug/AndroidManifest.xml:30 unknown element <action> found
Error:/home/paolorotolo/dev/exp/core/***/build/intermediates/manifests/full/debug/AndroidManifest.xml:33 unknown element <category> found
Error:java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.AaptException: AAPT2 link failed:
Error:com.android.builder.internal.aapt.AaptException: AAPT2 link failed:
Error:Execution failed for task ':***:processDebugResources'.
> Failed to execute aapt
Information:BUILD FAILED in 6s
The issue has been fixed in new gradle release (gradle-4.1-rc-2).
To solve add in your gradle-wrapper.properties:
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-rc-2-all.zip
For now using gradle 4.1, or even 4.2 on your gradle wrapper will break builds that have dependencies
I solved this issue by taking back my gradle classpath depency back to gradle 2.3.3
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
You should check your AndroidManifest.xml,make sure every element like 'action' or 'category' is in right position.
I have got the similar issue recently, The way I solved is by invalidating the cache. You can do that in android studio-> File-> Invalidate cache/ Restart.
After that it stop showing me those ActivityFeed error.