久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

Android Gradle DexException:多個dex文件定義Lorg/hamcres

Android Gradle DexException: Multiple dex files define Lorg/hamcrest/Description(Android Gradle DexException:多個dex文件定義Lorg/hamcrest/Description)
本文介紹了Android Gradle DexException:多個dex文件定義Lorg/hamcrest/Description的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

com.android.dex.DexException:多個 dex 文件定義 Lorg/hamcrest/Description

在嘗試通過 Android Studio 或通過我的應用程序上的 Gradle 命令行進行調(diào)試構(gòu)建/測試時發(fā)生.

occurring while trying to do a debug build/test either via Android Studio or via Gradle command-line on my application.

發(fā)布版本(沒有測試)工作正常,但是一旦包含測試(hamcrest 是一個測試庫),構(gòu)建就會失敗并出現(xiàn)上述錯誤.

The release build (without tests) works fine but as soon as testing is included (hamcrest being a testing library), the build fails with the above error.

我檢查了我的模塊依賴項,沒有 gradle -q dependencies 證實的重復要求.

I've checked my module dependencies and there's no duplicate requirements which gradle -q dependencies corroborates.

項目設置.gradle

include ':[library module]'
include ':[main module]'

<小時>

項目 build.gradle

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.9.+'
        classpath 'org.robolectric.gradle:gradle-android-test-plugin:0.9.+'
    }
}

allprojects {
    repositories {
        mavenCentral()
    }
}

<小時>

[庫模塊] build.gradle

apply plugin: 'android-library'

android {
    compileSdkVersion 19
    buildToolsVersion "19.0.0"

    defaultConfig {
        minSdkVersion 14
        targetSdkVersion 19
    }

    packagingOptions {
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
    }
}

dependencies {
    compile 'com.google.zxing:core:3.0.+'
    compile 'com.bugsnag:bugsnag-android:2.1.1+'
}

<小時>

[主模塊] build.gradle

apply plugin: 'android'

android {
    signingConfigs {
    release {
        [...]
    }
}

    sourceSets {
        main {
            manifest.srcFile 'src/main/AndroidManifest.xml'
            res.srcDirs = ['src/main/res']
        }
        androidTest {
            setRoot('src/test')
        }
        instrumentTest {
        }
    }

    compileSdkVersion 19
    buildToolsVersion '19.0.0'

    defaultConfig {
        minSdkVersion 14
        targetSdkVersion 19
        testPackageName "[main.packageName].tests"
    }

    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }

    packagingOptions {
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
    }
}

apply plugin: 'android-test'



androidTest {
    // configure the set of classes for JUnit tests
    include '**/*Test.class'

    // configure max heap size of the test JVM
    maxHeapSize = "2048m"
}

repositories {
    maven { url 'https://repo.commonsware.com.s3.amazonaws.com' }
    maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
}

dependencies {
    androidTestCompile 'junit:junit:4.10'
    androidTestCompile 'org.robolectric:robolectric:2.3-SNAPSHOT'
    androidTestCompile 'com.squareup:fest-android:1.0.+'
    compile project(':[library module]')
    compile 'com.github.gabrielemariotti.changeloglib:library:1.4.+'
    compile 'com.google.code.gson:gson:2.2.4'
    compile 'com.google.android.gms:play-services:+'
    compile 'com.android.support:appcompat-v7:+'
    compile ('de.keyboardsurfer.android.widget:crouton:1.8.+') {
        exclude group: 'com.google.android', module: 'support-v4'
    }
    compile files('libs/CWAC-LoaderEx.jar')
    compile 'com.squareup.okhttp:okhttp:1.5.+'
    compile 'com.octo.android.robospice:robospice:1.4.11'
    compile 'com.octo.android.robospice:robospice-cache:1.4.11'
    compile 'com.octo.android.robospice:robospice-retrofit:1.4.11'
    compile 'com.commonsware.cwac:security:0.1.+'
    compile 'com.readystatesoftware.sqliteasset:sqliteassethelper:+'
}

推薦答案

Robolectric 2.3 依賴于 JUnit 4.8.1(版本顯式).您正在導入 JUnit 4.10(顯式版本).Hamcrest 可能只是 dex 令人窒息的眾多副本中的第一個 - 嘗試將您的 JUnit 要求版本更改為 4.8+(或從 Robolectric 依賴項中排除 JUnit).

Robolectric 2.3 depends on JUnit 4.8.1 (version explicit). You're importing JUnit 4.10 (version explicit). Hamcrest is probably simply the first of many duplicates that dex is choking on - try changing your JUnit requirement version to 4.8+ (or excluding JUnit from the Robolectric dependency).

這篇關(guān)于Android Gradle DexException:多個dex文件定義Lorg/hamcrest/Description的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

IncompatibleClassChangeError after updating to Android Build Tools 25.1.6 GCM / FCM(更新到 Android Build Tools 25.1.6 GCM/FCM 后出現(xiàn) IncompatibleClassChangeError)
How to get current flavor in gradle(如何在 gradle 中獲取當前風味)
How to fix quot;unexpected element lt;queriesgt; found in lt;manifestgt;quot; error?(如何修復“意外元素lt;查詢gt;在“清單中找到錯誤?)
Multi flavor app based on multi flavor library in Android Gradle(基于 Android Gradle 中多風味庫的多風味應用)
Android dependency has different version for the compile and runtime(Android 依賴在編譯和運行時有不同的版本)
Transitive dependencies for local aar library(本地 aar 庫的傳遞依賴)
主站蜘蛛池模板: 日韩在线xx| av香港经典三级级 在线 | 精品国产一区二区久久 | 欧美日韩在线成人 | 亚洲男女激情 | 9久9久| h视频免费看 | 午夜爽爽爽男女免费观看影院 | 日韩在线免费视频 | 视频在线一区二区 | 欧美一区二区三区高清视频 | 欧美成人精品一区二区三区 | 精品久久精品 | 91看片在线观看 | 国产精品美女久久久免费 | 玖玖综合在线 | 免费一区在线观看 | 偷拍自拍网 | 日韩免费三级 | 一区二区久久精品 | 亚洲日韩中文字幕一区 | 久久精品日产第一区二区三区 | 91精品国产91久久久久久吃药 | 亚洲欧美激情四射 | 天天干天天爱天天爽 | 精品国产一区二区三区在线观看 | 久久网日本| 久久久久久亚洲精品 | a在线观看 | 精品99在线 | 91亚洲精华国产 | 国产精品成人久久久久a级 久久蜜桃av一区二区天堂 | 精久久久| 免费观看一区二区三区毛片 | 国产高清不卡 | 国产免费xxx | 久久宗合色 | 亚洲欧洲小视频 | 欧美视频 亚洲视频 | 成人免费视频观看视频 | 一区二区三区四区在线视频 |