1

I'm working on my very first android application which is almost complete now and ready to post on play store. But I'm unable to make the APK file :(

I'm using Android Studio 3.0.1

gradle-4.1

When I tried to make the APK file I got the error:

Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
> java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex

which was quickly resolved by adding multiDexEnabled true to

app/build.gradle

file. But after adding this I'm now getting another error:

Error:Execution failed for task ':app:transformClassesWithMultidexlistForDebug'.
> java.io.IOException: Can't write [D:\My Data\Android\1stApplicationTest\app\build\intermediates\multi-dex\debug\componentClasses.jar] (Can't read [C:\Users\USER_NAME\.gradle\caches\transforms-1\files-1.1\support-media-compat-26.0.2.aar\d7c069de85684fc017734fd1ac5ba973\jars\classes.jar(;;;;;;**.class)] (Duplicate zip entry [classes.jar:android/support/v4/media/VolumeProviderCompat.class]))

I'm unable to resolve this issue I tried number of solutions

  1. updated all the jars version as per build/sdk version of the application
  2. Removed duplicate/extra dependencies, if any
  3. Removed Build folders from root and inside of app folder
  4. In Android Studio File -> Invalidate Caches/Restart
  5. Restarted Android studio with the clean build, also removed extra jars in .idea folder

Please advise if i need to remvoe something from the SDK: C:\Users\USER_NAME\AppData\Local\Android\sdk

Here is app/build.gradle file of my application

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    buildToolsVersion '26.0.2'
    defaultConfig {
        applicationId 'Shah.Jee'
        minSdkVersion 15
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    productFlavors {
    }

}

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

    compile 'com.android.support:appcompat-v7:26.0.2'
    /*
    compile files('libs/android-support-v4.jar')
    compile 'com.android.support:support-v4:26.0.2'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.android.support:design:26.0.2'*/
    compile 'commons-lang:commons-lang:2.6'
    compile 'com.github.bumptech.glide:glide:4.2.0'
    compile 'com.google.android.exoplayer:exoplayer:r2.4.0'
    compile 'com.google.android.exoplayer:exoplayer-core:r2.4.0'
    compile 'com.google.android.exoplayer:exoplayer-dash:r2.4.0'
    compile 'com.google.android.exoplayer:exoplayer-hls:r2.4.0'
    compile 'com.google.android.exoplayer:exoplayer-smoothstreaming:r2.4.0'
    compile 'com.google.android.exoplayer:exoplayer-ui:r2.4.0'
    testCompile 'junit:junit:4.12'
    compile project(':picasso-2.5.2')
}

Need a quick advise if I'm missing something. Thanks in advance.

NoNaMe
  • 6,020
  • 30
  • 82
  • 110

0 Answers0