android - 为 Viger-PDF 添加依赖项时无法合并 dex 错误
问题描述
错误:任务':app:transformDexArchiveWithExternalLibsDexMergerForDebug'的执行失败
java.lang.RuntimeException:java.lang.RuntimeException:com.android.builder.dexing.DexArchiveMergerException:无法合并dex
运行android项目时发生此错误。
添加依赖后:
implementation 'com.github.aerdy:Android-Viger_View_Pager_PDF_OpenSource:-SNAPSHOT'
应用程序.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.trinityinfosystem.kv.mycollege"
minSdkVersion 16
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
maven { url "http://dl.bintray.com/lukaville/maven"}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:support-v4:27.1.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.android.support:recyclerview-v7:27.1.1'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'de.hdodenhof:circleimageview:2.2.0'
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
implementation 'com.github.bumptech.glide:glide:4.7.1'
implementation 'com.github.ittianyu:BottomNavigationViewEx:1.2.4'
implementation 'com.github.yalantis:Side-Menu.Android:1.0.1'
implementation 'com.google.android.gms:play-services-ads:15.0.1'
implementation 'com.facebook.android:audience-network-sdk:4.99.1'
implementation 'me.relex:circleindicator:1.2.2@aar'
implementation 'com.github.aerdy:Android-Viger_View_Pager_PDF_OpenSource:-SNAPSHOT'
}
解决方案
只需将 defaultConfig multiDexEnabled true 和 minifyEnabled true 添加到 build.gradle(Module:app) 文件中,然后同步您的项目
推荐阅读
- c# - 无法在矩形区域WPF C#中拖放文件或文件夹
- android - 在 android API 级别问题中使用 datetime 获取当前日期
- sql - ALTER TABLE 即使对于一个很小的表也需要很长时间
- oauth-2.0 - 如何获得我的 Linked In OAuth 2.0 客户端应用程序的 r_fullprofile 权限?
- node.js - 在代理后面运行节点
- ansible - 使用 Jinja 过滤器对数据进行 Ansible HTML 解析和 grep
- c++ - 如何检查字符串是否匹配 C++/Boost 正则表达式中的 *prefix*?
- node.js - 导入嵌套模块时找不到模块
- javascript - 我们有一个 2 个下拉列表,在选择第一个下拉列表的多个值时具有相同的值,第二个下拉列表值是自动选择的
- powershell - 如何使用powershell在变量数组和固定数字之间进行乘法?