0

My app is working properly. There is no problem. i want to build generated signed apk. The problem is building take too long and completed with errors. Please check the image. Thanks.

Error:Execution failed for task ':app:transformClassesWithDexForRelease'.> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: java.lang.UnsupportedOperationException

here my gradle;

android {
compileSdkVersion 24
buildToolsVersion "24.0.2"

defaultConfig {
    applicationId "umut.com.anyidea"
    minSdkVersion 19
    targetSdkVersion 24
    versionCode 1
    versionName "1.0"
    multiDexEnabled true
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}


dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support:design:24.2.1'
compile 'com.android.support:multidex:1.0.1'
compile 'com.google.firebase:firebase-messaging:9.6.0'
compile 'com.google.firebase:firebase-core:9.6.0'
compile 'com.google.firebase:firebase-crash:9.6.0'
compile 'com.google.android.gms:play-services:9.6.0'
compile 'com.google.android.gms:play-services-auth:9.6.0'
compile 'com.android.support:cardview-v7:+'
compile 'com.android.support:support-v4:24.2.1'
compile 'com.afollestad.material-dialogs:core:0.9.0.1'
compile 'com.google.firebase:firebase-database:9.6.0'
compile 'com.google.firebase:firebase-auth:9.6.0'
compile 'com.firebaseui:firebase-ui-database:0.6.0'
}
apply plugin: 'com.google.gms.google-services'

image of errors

Shabbir Dhangot
  • 8,954
  • 10
  • 58
  • 80
Recep Yesil
  • 148
  • 13
  • 1
    Show the entire stacktrace here, don't post photos. – Jared Burrows Oct 05 '16 at 05:35
  • Possible duplicate of [Error java.lang.OutOfMemoryError: GC overhead limit exceeded](http://stackoverflow.com/questions/1393486/error-java-lang-outofmemoryerror-gc-overhead-limit-exceeded) – Soham Oct 05 '16 at 05:54

5 Answers5

0

just add this and try. its works for me.

 defaultConfig {
        multiDexEnabled true
    }
    // multidex issues
        compile 'com.android.support:multidex:1.0.0'

or

dexOptions {
    javaMaxHeapSize "4g"
}
Rajesh Satvara
  • 3,842
  • 2
  • 30
  • 50
0

Have you add this in Application class

MultiDex.install(this);
Piyush
  • 18,895
  • 5
  • 32
  • 63
D.J
  • 1,439
  • 1
  • 12
  • 23
0

Put this line in defaultConfig block

multiDexEnabled true

And add the following dependencies

compile 'com.android.support:multidex:1.0.0'

After this rebuild your project. Hopefully this should resolve your error.

Furqan
  • 787
  • 2
  • 13
  • 28
0

In versions of Google Play services prior to 6.5, you had to compile the entire package of APIs into your app. In some cases, doing so made it more difficult to keep the number of methods in your app (including framework APIs, library methods, and your own code) under the 65,536 limit.

From version 6.5, you can instead selectively compile Google Play service APIs into your app. For example, to include only the Google Fit and Android Wear APIs,

Please refer this document: https://developers.google.com/android/guides/setup

for example if you need Google Account Login then just use : com.google.android.gms:play-services-auth:9.6.1 not use compile 'com.google.android.gms:play-services:9.6.1'

Damini Mehra
  • 3,257
  • 3
  • 13
  • 24
-1

Just remove unused libraries (or dependencies) from app's build.gradle file and again try to generate signed apk. It will work. :)

Swanand
  • 507
  • 6
  • 15