大家好我在尝试运行我的应用程序时得到error
错误:任务执行失败 ':应用程序:transformDexArchiveWithExternalLibsDexMergerForDebug&#39 ;. com.android.builder.dexing.DexArchiveMergerException:无法合并dex
我不知道为什么!
我还尝试了clean
和rebuild
项目,但我总是same
error
!
现在发布我的gradle
:
android {
compileSdkVersion 23
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "com.compscitutorials.basigarcia.navigationdrawervideotutorial"
minSdkVersion 19
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/notice.txt'
exclude 'META-INF/ASL2.0' }
}
dependencies {
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
//noinspection GradleCompatible
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.android.support:design:23.1.1'
compile 'de.hdodenhof:circleimageview:1.3.0'
//noinspection GradleCompatible
compile 'com.android.support:recyclerview-v7:26.1.0'
//noinspection GradleCompatible
compile 'com.android.support:cardview-v7:26.1.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.github.bumptech.glide:glide:3.8.0'
//compile 'com.android.volley:volley:1.0.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'
compile 'com.facebook.android:facebook-android-sdk:3.21.1'
//noinspection DuplicatePlatformClasses
implementation 'org.apache.httpcomponents:httpclient:4.5.3'
}
有人可以帮助我吗?
感谢先进!
答案 0 :(得分:0)
试试这个: -
第1步:修改应用级build.gradle
文件以启用multidex
并将multidex
库添加为依赖项,如下所示:
android {
defaultConfig {
...
minSdkVersion 15
targetSdkVersion 26
multiDexEnabled true
}
}
dependencies {
compile 'com.android.support:multidex:1.0.1'
}
第2步:如果您覆盖了Application
类,
public class MyApplication extends Application {
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
}
更多信息请查看link
答案 1 :(得分:0)
您应该 Upgrade
旧版本
compile 'com.android.support:appcompat-v7:26.1.0'
compile 'com.android.support:design:26.1.1'
compile 'com.facebook.android:facebook-android-sdk:4.16.0'
compile 'de.hdodenhof:circleimageview:2.2.0'
并设置
<强> compileSdkVersion 26
强>
之后, Clean-Rebuild-Run
。
答案 2 :(得分:0)
我可以在这个改变之后编译你的gradle:
compile 'com.android.support:appcompat-v7:26.1.0'
compile 'com.android.support:design:26.1.0'
compile 'com.android.support:support-core-utils:26.1.0'
而不是
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.android.support:design:23.1.1'
以及
android {
compileSdkVersion 26
而不是
android {
compileSdkVersion 23