A failure occurred while executing com.android.build.gradle.tasks.PackageAndroidArtifact$IncrementalSplitterRunnable

20k views Asked by At

I got the error when I trying to convert signing in apk. before it was working. after adding the buildTyper it's not working. can anyone help me with this issue? or anything did wrongly?

    release {
        minifyEnabled true
        proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        resValue "string", "google_maps_key", "AIzaxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
        debuggable true
        multiDexEnabled true
        signingConfig signingConfigs.Able
        jniDebuggable true
        renderscriptDebuggable true
    }

    debug {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        resValue "string", "google_maps_key", "AIzaxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
    }
4

There are 4 answers

3
LanDenLabs On BEST ANSWER

The approved solution defeats the purpose of having a smart Gradle build process which compiles and links only the required code. If every time this error occurs the solution is to stop and delete the build you are killing productivity.

I get this error about 1 out of every 10 builds.

My quick fix - is within Android Studio - open the Terminal panel (typically bottom of studio). Run shell command

rm -rf build/output/apk

This always works - but still is a big pain to do every 10 builds. I have had this problem for the last year, so multiple OS updates, multiple Studio updates, etc.

Wish they would fix this. I have tried to disable "incremental building", but no impact on this problem.

gradle.properties

org.gradle.parallel=false
org.gradle.caching=false
org.gradle.configureondemand=false

build.gradle

gradle.projectsEvaluated {
    tasks.withType(JavaCompile) {
        options.incremental = false

    }
}
2
Ali Maddi On

The solution is so easy! Before start build or signing your project,

  1. close android studio
  2. delete manually \app\build and \app\release and \app\debug folders
  3. close all other folders
  4. try again build or signing your project

Pay attention that no folder should be open from \app\debug and \app\release or any subdirectory of them in file explorer!

2
M_droid On

Adding this line org.gradle.jvmargs=-Xmx4608m to gradle.properties fixed it.

Because while I got A failure occurred while executing com.android.build.gradle.tasks.PackageAndroidArtifact$IncrementalSplitterRunnable reported, it also said something like ...Java Heap Size.

0
Sylvester Yao On

Add this to gradle.properties at proj root dir:

android.useNewApkCreator=false