将字节码转换为 dex IInAppBillingService 时出错



>当我想测试应用程序时,我收到一条错误消息:

错误:将字节码转换为 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'
}

我看到您正在使用com.android.billingclient:billing进行应用内计费。

如果您之前通过 AIDL 使用应用内计费,请尝试从项目中删除"IInAppBillingService.aidl"文件。

这应该可以解决您的问题。

相关内容

  • 没有找到相关文章

最新更新