My code is running fine on device but when i try to generate Signed APK, it starts giving error;
Information:Gradle tasks [:assembleRelease]
Error:UNEXPECTED TOP-LEVEL ERROR:
Error:java.lang.OutOfMemoryError: GC overhead limit exceeded
Error:Execution failed for task ':transformClassesWithDexForRelease'.
> com.android.build.api.transform.TransformException:com.android.ide.common.process.ProcessException:java.util.concurrent.ExecutionException:
java.lang.UnsupportedOperationException
Information:BUILD FAILED
In my Gradle file the only thing which is causing problem is this line, if i remove this line it will generate the signed APK.
compile 'com.google.android.gms:play-services:9.6.1'
Here is my Gradle file;
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.1'
}
}
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
useLibrary 'org.apache.http.legacy'
defaultConfig {
minSdkVersion 15
targetSdkVersion 23
versionCode = 2
versionName = "1.0.2"
multiDexEnabled true
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
jniLibs.srcDirs = ['libs']
jni.srcDirs = []
}
instrumentTest.setRoot('tests')
}
signingConfigs {
release
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
}
// ~/.gradle/gradle.properties
if (project.hasProperty('keystoreFile') &&
project.hasProperty('keystorePassword') &&
project.hasProperty('keystoreAliasPassword')) {
android.signingConfigs.release.storeFile = file(keystoreFile)
android.signingConfigs.release.storePassword = keystorePassword
android.signingConfigs.release.keyPassword = keystoreAliasPassword
android.signingConfigs.release.keyAlias = keystoreAlias
} else {
android.buildTypes.release.signingConfig = null
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:support-v4:23.0.1'
compile 'com.google.android.gms:play-services:9.6.1'
}
And these are the libraries i have in lib folder of my project;