当我想测试应用程序时,我收到一条错误消息:
错误:将字节码转换为dex时出错: 原因:com.android.dex.DexException:多个dex文件定义Lcom / android / vending / billing / IInAppBillingService;
我的build.gradle应用:
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
defaultConfig {
applicationId "automation.test.application"
minSdkVersion 19
targetSdkVersion 27
versionCode 25
versionName "2.6.0"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
mavenCentral()
maven { url 'https://maven.google.com' }
}
dependencies {
api fileTree(include: ['*.jar'], dir: 'libs')
api'com.android.billingclient:billing:1.0'
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
//noinspection GradleCompatible,GradleCompatible
api 'com.android.support:appcompat-v7:27.0.2'
api 'com.google.android.gms:play-services-ads:11.8.0'
api 'com.android.support:design:27.0.2'
api 'com.android.support.constraint:constraint-layout:1.0.2'
api 'com.anjlab.android.iab.v3:library:1.0.44'
api 'com.android.support:support-v4:27.0.2'
testCompile 'junit:junit:4.12'
api 'com.android.support:gridlayout-v7:27.0.2'
api 'com.android.support:support-v4:27.0.2'
api 'com.android.billingclient:billing:1.0'
}
答案 0 :(得分:0)
我发现您正在使用com.android.billingclient:billing
进行应用内结算。
如果您以前使用AIDL进行应用内结算,请尝试从项目中删除“ IInAppBillingService.aidl”文件。
那应该可以解决您的问题。