Unable to build project with gradle 4.1: "unknown element * found"

Viewed 3057

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
4 Answers

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.

Related