12

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"
    }
shakthivel
  • 199
  • 2
  • 3
  • 14

4 Answers4

19

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

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

M_droid
  • 2,447
  • 2
  • 25
  • 35
11

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!

Ali Maddi
  • 309
  • 3
  • 8
5

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

    }
}
LanDenLabs
  • 1,566
  • 16
  • 10
0

Add this to gradle.properties at proj root dir:

android.useNewApkCreator=false
Sylvester Yao
  • 237
  • 2
  • 7