[英]“Multiple dex files define” error when building APK in android studio
This is my app gradle file.The exact error I am getting is the following 这是我的应用程序gradle文件。我得到的确切错误如下
Error:Execution failed for task ':app:transformClassesWithDexForDebug'.>com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexException: Multiple dex files define Lcom/github/barteksc/pdfviewer/listener/OnPageChangeListener;
build.gradle : build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "25.0.0"
defaultConfig {
applicationId "com.daniel.haughton93.dunnesstoresoffers"
minSdkVersion 16
targetSdkVersion 24
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {}
}
dependencies {
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support',
module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:24.2.1'
testCompile 'junit:junit:4.12'
compile files('src/main/java/com/daniel/haughton93/dunnesstoresoffers/jsoup-1.10.1.jar')
compile 'com.google.android.gms:play-services-appindexing:8.4.0'
compile 'com.github.barteksc:android-pdf-viewer:2.3.0'
}
This problem is due to android-pdf-viewer dependency so try below steps might be you will get solution. 此问题是由于android-pdf-viewer依赖性所致,因此尝试以下步骤可能会得到解决。
I would suggest that you really take out all the id's and references that you do not need and make a Clean Project and then Rebuild. 我建议您真正删除所有不需要的ID和参考,并进行“清理项目”,然后重新构建。
If the above does not work then modify the build.gradle(Modude:app) like this: 如果上述方法不起作用,则按如下所示修改build.gradle(Modude:app):
android {
defaultConfig {
...
minSdkVersion 21
targetSdkVersion 25
multiDexEnabled true <-- the line that matters
}
...
}
Hope it helps!!! 希望能帮助到你!!!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.