A few days ago, I updated my Android studio and now I have a problem.
Actually, I am trying to create an APK file from my project in order to test my application on a real device, and when I click Build → Build Apk , I get a couple of errors in the Message Gradle Build. I do not know why these errors go, please explain in detail the reason.
Mistakes
Error: bytecode to dex conversion error:
Reason: com.android.dex.DexException: multiple dex files define Lcom / android / volley / VolleyError;
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_51 \ bin \ java.exe '' terminated with nonzero exit value 2
build.gradle file
apply plugin: 'com.android.application' android { signingConfigs { } compileSdkVersion 23 buildToolsVersion "23.0.1" defaultConfig { applicationId "com.dovezeal.gapp" minSdkVersion 19 targetSdkVersion 23 versionCode 1 versionName "1.0" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } compileOptions { sourceCompatibility JavaVersion.VERSION_1_7 targetCompatibility JavaVersion.VERSION_1_7 } } dependencies { compile fileTree(include: ['*.jar'], dir: 'libs') compile 'com.android.support:appcompat-v7:23.0.1' //compile 'com.android.support:appcompat-v7:23.3.0' compile 'com.android.support:support-v4:23.3.0' compile 'com.android.support:design:23.0.1' compile 'com.android.support:design:23.1.1' // Volley compile 'com.android.volley:volley:1.0.0' //compile 'com.mcxiaoke.volley:library:1.0.+' /* compile files('libs/com.mcxiaoke.volley library-1.0.0.jar')*/ // RecyclerView compile 'com.android.support:recyclerview-v7:23.0.+' // A simple way to define and render UI specs on top of your Android UI. compile 'org.lucasr.dspec:dspec:0.1.1' compile files('libs/library-1.0.0.jar') // YouTube Player compile files('libs/YouTubeAndroidPlayerApi.jar') // GOSN /* compile files('libs/gson-2.2.3.jar')*/ }
Change - 1
As janki gadhiya said in his comment below, change minifyEnabled true and try adding multiDexEnabled true to defaultConfig
with these changes, both of the above errors disappeared, but now this next error occurs.
- Error: execution failed for task: app: transformClassesWithJarMergingForDebug com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com / android / volley / Request $ Priority.class
android build.gradle apk
Arsh kaushal
source share