Whenever I create a project and prepare to run on my device, I keep getting this error:
Error: the number of method references in the .dex file cannot exceed 64 KB. Learn how to fix this problem at https://developer.android.com/tools/building/multidex.html
In addition, I get this error:
Error: execution completed for task ': app: transformClassesWithDexForDebug'. com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: org.gradle.process. internal.ExecException: Process 'command' C: \ Program Files \ Java \ jdk1.8.0_91 \ bin \ java.exe '' completed with nonzero exit value 2
And he says gradle build failed with two errors
So, I have a few questions:
- What are dex files
- I do not use them directly, so why can I get the errors above?
- What is in dex files?
- Do these files have anything to say for the .APK file size?
These errors started to appear again after I stopped using proguard for debugging collections, since StackTrace did not show, and right before I activated proguard, I had an error.
I had this error once before, and I deleted the dex folder, and she solved it, but now this all of a sudden is not enough.
my gradle file:
apply plugin: 'com.android.application' android { compileSdkVersion 23 buildToolsVersion "23.0.3" defaultConfig { applicationId "com.example.myproject" minSdkVersion 15 targetSdkVersion 23 } buildTypes { release { minifyEnabled true shrinkResources true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha1' compile 'com.android.support:support-v4:23.3.0' compile 'com.google.android.gms:play-services:9.2.0' compile 'com.google.android.gms:play-services-ads:9.2.0' }
source share