android - 在android中的ui依赖中添加brain tree drop时dex文件无法合并
问题描述
朋友们,我正在开发一个有支付选项的安卓应用程序。我想要 PayPal 集成,所以我使用具有脑树 SDK 支持的 Braintree 直接方法,但是当我添加 UI 依赖项时它显示错误。
Error:Execution failed for
task:app:transformDexArchiveWithExternalLibsDexMergerForDebug.
> java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
我附上下面的gradle文件
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'
testImplementation 'junit:junit:4.12'
implementation 'com.braintreepayments.api:braintree:2.+'
implementation 'com.braintreepayments.api:drop-in:3.0.0'
}
build.gradle 文件
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
multiDexEnabled true
applicationId "com.stunntech.paypalandroid"
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'
}
}
}
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'
testImplementation 'junit:junit:4.12'
implementation 'com.braintreepayments.api:braintree:2.4.0'
// implementation 'com.braintreepayments.api:drop-in:3.0.5'
}
解决方案
查看有关此问题的回复,据我了解,您也有同样的问题:
希望对你有帮助
启用 MultiDex:
android {
defaultConfig {
// Enabling multidex support.
multiDexEnabled true
}
dexOptions {
jumboMode true
}
}
dependencies {
implementation 'com.android.support:multidex:1.0.3'
}
推荐阅读
- c# - 如何为 mac 的 dotnet 添加 System.Windows.Data 参考
- javascript - React & Typescript - 如果发送其他参数,是否可以阻止发送参数?
- java - 在谓词期间获取 NullPointerException
- python - 为什么这个 python 代码没有完全执行?
- docker - 如何在 docker-compose 服务中更新 celery 工作人员,但保持长时间运行的任务处于活动状态,直到他们完成
- javascript - 表不从数组中导入值(Handlebars/html/javascript)
- html5-canvas - 如何使用画布 getImageData() 和 putImageData() 复制画布的一部分并将其粘贴到另一个位置?
- node.js - Nuxt Universal Static 不是路由页面
- python - 更改颜色条的格式刻度
- json - Laravel 前缀路由和 json 文件 url 不匹配