我正在开发我的第一个Android应用程序,现在几乎已经完成并准备在Play商店发布。但是我无法制作APK文件:(
我正在使用Android Studio 3.0.1
的gradle-4.1
当我尝试制作APK文件时出现错误:
Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
> java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
通过将multiDexEnabled true
添加到
应用程序/的build.gradle
文件。但是在添加之后我现在又出现了另一个错误:
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]))
我无法解决此问题,我尝试了多种解决方案
File -> Invalidate Caches/Restart
请告知我是否需要从SDK中删除一些内容:C:\Users\USER_NAME\AppData\Local\Android\sdk
这是我的应用程序的app / build.gradle文件
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')
}
如果我遗漏了某些东西,需要快速建议。提前致谢。