Generate APK - error

Asked

Viewed 83 times

0

Hello, I’m trying to generate signed APK and is giving error:

Error:The number of method References in a . Dex file cannot exceed 64K. Learn how to resolve this Issue at https://developer.android.com/tools/building/multidex.html

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

I think my app has no more than 64 K.

My Gradle is like this: android { compileSdkVersion 24 buildToolsVersion "24.0.2"

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

}

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

compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support:design:24.2.1'
compile 'com.parse.bolts:bolts-android:1.+'
compile 'com.parse:parse-android:1.+'
compile 'com.android.support:support-v4:24.2.1'
compile 'com.google.android.gms:play-services-appindexing:9.8.0'
compile 'com.facebook.fresco:fresco:0.14.1'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.google.android.gms:play-services:9.8.0'
compile 'com.android.support:cardview-v7:24.2.1'

}

Detail I am not using any Google service, it is normal to appear two dependencies Google?

In my Android Manifest is also two Google keys.

What do I need to do to generate the signed APK? Thank you.

  • 1

    Can you double check if you are not using any Google service? If you can search for Googleapiclient in your code. Because the dependence on play-services:9.8.0 adds all Google Play Services service modules. If you are using, you would have to remove the play-services:9.8.0 and add the more specific modules.

  • Hi. I’m not using, I even tried to put a map and a geocoder. But then, I decided to make an Intent to consult the Googlemaps on the user’s mobile phone if it has installed.

  • I can delete this line then?

  • Yes, you should delete yes, it generates tens or hundreds of thousands of Dex Count to your app. If so, you should delete the play-services-appindexing:9.8.0 also.

  • Now this came up:

  • To run Dex in process, the Gradle daemon needs a Larger heap. It Currently has 1024 MB. For Faster builds, Increase the Maximum heap size for the Gradle daemon to at least 1536 MB. To do this set org.gradle.jvmargs=-Xmx1536m in the project Gradle.properties. For more information see https://docs.gradle.org/current/userguide/build_environment.html :app:mergeReleaseJniLibFolders :app:transformNative_libsWithMergeJniLibsForRelease :app:processReleaseJavaRes UP-TO-DATE :app:transformResourcesWithMergeJavaResForRelease :app:validateSigningRelease :app:packageRelease :app:assembleReleas

  • It’s not a mistake, I believe the build is being completed, isn’t it? This is just a warning that the build will be faster if you add more memory to Gradle. But this needs a different configuration and goes beyond the scope of the question.

Show 2 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.