Error:Execution failed for task ':app:transformClassesWithFirebasePerformancePluginForRelease'

execution failed for task ':app:checkdebugduplicateclasses
execute task action error android studio
org gradle execution multiplebuildfailures build completed with 1 failures
execution failed for task ':app:processdebugmanifest
gradle build failed
execution failed for task ':app:mergeextdexdebug
execution failed for dexingnoclasspathtransform
gradle build failed android studio

I can not find the origin of this error when I compile in release mode. I have the impression that this error appeared without modifying my code (I try to go back with github but I still have this error).

Error:Execution failed for task ':app:transformClassesWithFirebasePerformancePluginForRelease'.

java.io.IOException: The specified path was not found

Gradle with debug flag

22:36:11.767 [ERROR] [FirebasePerformancePlugin] Can't instrument org/apache/xmlbeans/impl/schema/SchemaTypeSystemCompiler.class

My build.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
        mavenCentral()
        maven { url 'https://maven.fabric.io/public' }
        maven {
            url 'https://maven.google.com'
        }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.3'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
        classpath 'com.google.gms:google-services:3.1.0'
        classpath 'com.google.firebase:firebase-plugins:1.1.0'
        classpath 'io.fabric.tools:gradle:1.+'
    }
}

allprojects {
    repositories {
        jcenter()
        maven {
            url 'http://www.idescout.com/maven/repo/'
        }
        maven {
            url 'https://maven.google.com'
        }
    }
}

My app/build.gradle

apply plugin: 'com.android.application'
apply plugin: 'com.google.firebase.firebase-perf'
apply plugin: 'io.fabric'

android {

    compileSdkVersion 26
    buildToolsVersion '26.0.0'
    defaultConfig {
        applicationId ""
        minSdkVersion 16
        targetSdkVersion 26
        multiDexEnabled true

        vectorDrawables.useSupportLibrary = true
        testInstrumentationRunner 'android.support.test.runner.AndroidJUnitRunner'
    }
    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'),
                    'proguard-rules.pro'
            signingConfig signingConfigs.Keys
        }
        debug {
            signingConfig signingConfigs.Keys
        }
    }
    dexOptions {
        jumboMode = true
    }

    packagingOptions {
        pickFirst 'META-INF/*'
    }
}

repositories {
    jcenter()
}
repositories {
    maven { url "http://repo1.maven.org/maven2" }
    maven { url 'https://jitpack.io' }
    maven { url 'https://maven.fabric.io/public' }
}

repositories {
    mavenCentral()
    mavenLocal()
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')

    compile 'com.android.support:appcompat-v7:26.0.0-beta2'
    compile 'com.android.support:support-v13:26.0.0-beta2'
    compile 'com.android.support:support-v4:26.0.0-beta2'
    compile 'com.android.support:design:26.0.0-beta2'
    compile 'com.android.support:recyclerview-v7:26.0.0-beta2'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.android.support:cardview-v7:26.0.0-beta2'
    compile 'com.android.support:customtabs:26.0.0-beta2'

    //firebase
    compile 'com.google.firebase:firebase-ads:11.0.2'
    compile 'com.google.firebase:firebase-core:11.0.2'
    compile 'com.google.firebase:firebase-messaging:11.0.2'
    compile 'com.google.firebase:firebase-auth:11.0.2'
    compile 'com.google.firebase:firebase-database:11.0.2'
    compile 'com.google.firebase:firebase-config:11.0.2'
    compile 'com.google.firebase:firebase-storage:11.0.2'
    compile 'com.google.firebase:firebase-perf:11.0.2'
    compile 'com.firebaseui:firebase-ui-auth:1.2.0'

    //Fabric
    compile('com.crashlytics.sdk.android:crashlytics:2.6.8@aar') {
        transitive = true;
    }


    compile 'com.android.support:support-vector-drawable:26.0.0-beta2'
    compile 'commons-io:commons-io:2.5'

    compile 'com.android.support:multidex:1.0.1'
    compile files('libs/aa-poi-ooxml-schemas-3.10-reduced-more-0.1.5.jar')
    compile files('libs/aa-poi-3.10-min-0.1.5.jar')
}

apply plugin: 'com.google.gms.google-services'

After migrating my Android project to Gradle Kotlin DSL I suddenly also receive the Can't instrument error by the Firebase Performance Plugin for any class of the project, including third-party dependencies. The build eventually aborts with an OutOfMemoryError. The error is

Can't instrument: ...
java.lang.IllegalArgumentException
        at org.objectweb.asm.ClassVisitor.<init>(ClassVisitor.java:79)
        at com.google.firebase.perf.plugin.instrumentation.InstrumentationVisitor.<init>(InstrumentationVisitor.java:55)
        ...

Looking at the source code of ASM's ClassVisitor I see that IllegalArgumentException is thrown in the constructor when an unhandled api version is passed. perf-plugin requires version 7.0 of ASM. However when checking the project dependencies with ./gradlew :app:dependencies I find out that version 6.0 of ASM is used. Obviously some other dependency requires 6.0.

I tried to explicitly overwrite the ASM dependency with

configurations.all {
    resolutionStrategy.eachDependency {
        if (requested.group == "org.ow2.asm") {
            useVersion("7.0")
            because("Version required by Firebase Performance Plugin")
        }
    }
}

and in the output of ./gradlew :app:dependencies I now see that 7.0 is used but I still receive this error :(

Update: Downgrading com.google.firebase:firebase-plugins from 1.2.0 to 1.1.5 solves the problem for me.

Update 2: As of version 2.0.0 of firebase-plugins its usage is deprecated. The recommended solution is now to use the Performance Monitoring plugin explicitly. After migrating to the new plugin the problem is now solved for me.

Update 3: I must withdraw my previous statement. Using the Performance Monitor plugin did fix the build on my local machine but not on my Jenkins build server. Also moving the configurations.all block mentioned above into the buildscript block as commented by Antimonit did not fix the build, although I can see in the output of ./gradlew buildEnvironment that ASM 7.0 is used for the build.

Build Error "Execution failed for task ':app , I had the same problem, I did some changes in build.gradle (Module: app) and it worked for me. I changed this androidTestImplementation� FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':processReleaseResources'. > com.android.ide.common.process.ProcessException: Failed to execute aapt * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. BUILD FAILED. Total time: 19.209 secs

Reason: When the classpath dependency to perf-plugin is defined in the app-level build.gradle file instead of project-level build.gradle file, perf-plugin (at runtime) get's the ASM v6 dep even though in it's POM file ASM v7 dep is declared. This triggers the IllegalArgumentException in the perf-plugin v1.2.0 and v1.2.1 because they depend on ASM v7 however it works fine for v1.1.5 because it depend on ASM v6.

There are a host of posts here that explain why the classpath of the top level buildscript is intended to be different from the rest of the project:


Solution: This is gradle behavior. A quick solution to this is to define the perf-plugin dependency only in the root-project build.gradle (which is already mentioned in the public docs).


Detailed Explanation:

NO BUG

root-project build.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        google()
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.4.1'
        classpath 'com.google.firebase:perf-plugin:1.2.1'
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

app-level build.gradle

apply plugin: 'com.android.application'
apply plugin: 'com.google.firebase.firebase-perf'


. . .

dependencies {
    implementation 'com.google.firebase:firebase-perf:17.0.2'
}

BUG

root-project build.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        google()
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.4.1'
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

app-level build.gradle

buildscript {
    repositories {
        google()
        jcenter()
    }

    dependencies {
        classpath 'com.google.firebase:perf-plugin:1.2.1'
    }
}

apply plugin: 'com.android.application'
apply plugin: 'com.google.firebase.firebase-perf'


. . .

dependencies {
    implementation 'com.google.firebase:firebase-perf:17.0.2'
}

Comparison of $ ./gradlew clean :buildEnvironment command on both cases shows that all the references to org.ow2.asm:asm:6.0 is converted to org.ow2.asm:asm:7.0 in case of No Bug but that didn't happened in the Bug case:

NO BUG
> Task :buildEnvironment

------------------------------------------------------------
Root project
------------------------------------------------------------

.  .  .

    +--- com.android.tools.build.jetifier:jetifier-processor:1.0.0-beta04
|    |    +--- org.ow2.asm:asm:6.0 -> 7.0
|    |    +--- org.ow2.asm:asm-util:6.0 (*)
|    |    +--- org.ow2.asm:asm-commons:6.0 (*)
|    |    +--- org.jdom:jdom2:2.0.6
|    |    +--- org.jetbrains.kotlin:kotlin-stdlib:1.3.0 -> 1.3.31 (*)
|    |    \--- com.android.tools.build.jetifier:jetifier-core:1.0.0-beta04 (*)
|    +--- com.google.protobuf:protobuf-java:3.4.0
|    \--- com.google.protobuf:protobuf-java-util:3.4.0 (*)
\--- com.google.firebase:perf-plugin:1.2.1
     \--- org.ow2.asm:asm:7.0
BUG
> Task :buildEnvironment

------------------------------------------------------------
Root project
------------------------------------------------------------

.  .  .

     +--- com.android.tools.build.jetifier:jetifier-processor:1.0.0-beta04
     |    +--- org.ow2.asm:asm:6.0
     |    +--- org.ow2.asm:asm-util:6.0 (*)
     |    +--- org.ow2.asm:asm-commons:6.0 (*)
     |    +--- org.jdom:jdom2:2.0.6
     |    +--- org.jetbrains.kotlin:kotlin-stdlib:1.3.0 -> 1.3.31 (*)
     |    \--- com.android.tools.build.jetifier:jetifier-core:1.0.0-beta04 (*)
     +--- com.google.protobuf:protobuf-java:3.4.0
     \--- com.google.protobuf:protobuf-java-util:3.4.0 (*)

Gradle Error | Execution failed for task, This video shows how to solve "Execution failed for task':app:compileDebugAidll'. error Duration: 4:54 Posted: 16 Oct 2017 Check for the processes running in your system(Ubuntu) like in task manager in windows. Ubuntu terminal command to list out all processes running —-> “gnome-system-monitor” Terminate or end the JAVA and ANDROID processes in the list. Again start the studio and import project. Its works for me without any problems. Hope this helps…

I had the same error, because my buildSrc directory contained the fork of gradle android junit jacoco plugin. Once I got rid of it (actually I replaced source code fork by dependency on original plugin), error'd gone. If none of above advice helps you, try to check your buildSrc directory.

Error:Execution failed for task | Resolved versions for app, Error:Execution failed for task ':app:preDebugAndroidTestBuild'. Conflict with dependency Duration: 0:47 Posted: 20 May 2018 Error:Execution failed for task ':react-native-maps:compileReleaseJavaWithJavac' #2124. Closed Luckygirlllll opened this issue Mar 23, 2018 · 7 comments

Compilation Error Execution failed for task ':app , When trying to make a beta version on Crashlytics using Fastlane Command executed fastlane beta Complete output when running fastlane,� Error:Execution failed for task ':app:processDebugResources'. > com.android.ide.common.process.ProcessException: Failed to execute aapt What does it mean? How do I fix it?

Error:Execution failed for task ':ArJpctBaseLib , Just downloaded source and imported the library, getting this errror when trying to build the project Error:Execution failed for task� For what I can see, if you have a multi-module project with Android Studio and gradle, the IDE try to merge manifest files from every module into a Main manifest.. If you have a module A and a module B, and in the A manifest you declare some activity from B module, gradle will enconter a issue when merging.

I am getting error — Execution failed for task ':app:kaptDebugKotlin , I am getting error — Execution failed for task ':app:kaptDebugKotlin'.” is published by Akshay Nandwana. Questions: Error:Execution failed for task':app:compileDebugKotlin'. &gt; Compilation error.

Comments
  • Please run gradle with --debug and look for something more descriptive.
  • @DougStevenson 22:36:11.767 [ERROR] [FirebasePerformancePlugin] Can't instrument org/apache/xmlbeans/impl/schema/SchemaTypeSystemCompiler.class I get the impression that the problem comes from the Apache library POI that is not compatible with a FirebasePerf. What do you think ? The complete trace is here : pastebin.com/KeP1xwcX
  • Interesting, I've never seen that sort of error before. Perf is failing on dealing with that one particular class from the Apache lib. I'll see if I can get someone here at Firebase to look at it.
  • I can confirm similar behaviour. On our Jenkins slave we started to get this error and downgrading to 1.1.5 solved it.
  • I can also confirm similar issue when updating com.google.firebase:perf-plugin from 1.1.5 to 1.2.1. I am also using Kotlin DSL.
  • I've experienced similar issues when upgrading to either 1.2.0 or 1.2.1 from 1.1.5. In our case we were not using Kotlin DSL though. We didn't get OutOfMemoryError but this started generating log files on our CI which were 350MB in size instead of 150 KB like they used to be!
  • Your proposed solution actually works but you might have defined it in a wrong place. Because it is build process that is failing, you want the resolution strategy to be applied for the Gradle process itself, not application on the device. If you place the configurations.all {} block into buildscript {} of root build.gradle file, it will correctly update versions to 7.0. Also you should be checking for dependencies of buildscript, not :app module. Use gradlew buildEnvironment to see dependencies of buildscript.
  • @Antimonit I moved the configurations.all block into buildscript and see in the output of ./gradlew buildEnvironment that ASM 7.0 is used, but the build still fails :(
  • Sadly, we have plugin defined only at root level build.gradle but are still seeing this error.
  • I, too, have only defined the plugin at root level and (still) see this error with firebase-plugins 1.2.0.
  • @tir38 and Sven Jacobs Can you share the sample project (over GitHub maybe) so that I can take a look at your configurations and see why this is still happening?