如何解决任务的执行失败':app:transformClassesWithDexForDebug'?

时间:2017-04-24 22:16:25

标签: java android

我目前正在开发Android应用并实施应用内购买。

我的应用程序在模拟器模式下运行良好,但是当我尝试构建APK时,我收到以下错误:

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/android/vending/billing/IInAppBillingService;

我不确定究竟是什么原因,但这是我正在使用的库(IAP库): forces the payload to be considered to be a HasMetadata object

最后,这是我设置的Gradle版本,用于正确编译库:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"
    defaultConfig {
        applicationId "flarehubpe.xflare.flarehub"
        minSdkVersion 15
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile 'com.anjlab.android.iab.v3:library:1.0.+'
    compile fileTree(dir: 'libs', include: ['*.jar'])
    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:25.2.0'
    testCompile 'junit:junit:4.12'
}

我做错了什么?

0 个答案:

没有答案