构建应用程序时Gradle出错

时间:2014-08-07 12:01:58

标签: android gradle libraries

我正在尝试在Android Studio 0.8.2中构建我的应用。当我尝试运行它时会出现问题。由于某种原因,gradle与某些事情有冲突。我正在尝试从API 9到最新的API 20。

这是我的build.gradle文件:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 20
    buildToolsVersion "20.0.0"

    defaultConfig {
        applicationId "com.victor.martin.conex"
        minSdkVersion 9
        targetSdkVersion 19
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:20.0.+'
    compile 'com.wu-man:android-oauth-client:0.0.3'
    compile 'com.mcxiaoke.volley:library:1.0.6'
    compile 'com.android.support:support-v4:19.+'
}

我收到了这个错误:

Information:Gradle tasks [:app:assembleDebug]
:app:preBuild
:app:compileDebugNdk UP-TO-DATE
:app:preDebugBuild
:app:checkDebugManifest
:app:preReleaseBuild
:app:prepareComAndroidSupportAppcompatV72000Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42000Library UP-TO-DATE
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources UP-TO-DATE
:app:processDebugManifest UP-TO-DATE
:app:processDebugResources UP-TO-DATE
:app:generateDebugSources UP-TO-DATE
:app:compileDebugJava UP-TO-DATE
:app:preDexDebug
:app:dexDebug
UNEXPECTED TOP-LEVEL EXCEPTION:
Error:Execution failed for task ':app:dexDebug'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
    C:\Android\android-studio\sdk\build-tools\android-4.4W\dx.bat --dex --num-threads=4 --output C:\Workspace\Android\Conex\app\build\intermediates\dex\debug C:\Workspace\Android\Conex\app\build\intermediates\classes\debug C:\Workspace\Android\Conex\app\build\intermediates\dependency-cache\debug C:\Workspace\Android\Conex\app\build\intermediates\pre-dexed\debug\android-oauth-client-0.0.3-49fd75ef5b0a817054f5916ff5ab54e14808bab3.jar C:\Workspace\Android\Conex\app\build\intermediates\pre-dexed\debug\classes-7cc46d0cb0bae00ca10de80a1f015bec4e31990d.jar C:\Workspace\Android\Conex\app\build\intermediates\pre-dexed\debug\classes-b29c1edb89ef40290152f03d9eac909b3feba18a.jar C:\Workspace\Android\Conex\app\build\intermediates\pre-dexed\debug\google-api-client-1.15.0-rc-d02487f9cafb438018cb25fdba9a44f98cf578bc.jar C:\Workspace\Android\Conex\app\build\intermediates\pre-dexed\debug\google-api-client-android-1.15.0-rc-2abbb143ab6f5e10640eed5256568f576dd7d007.jar C:\Workspace\Android\Conex\app\build\intermediates\pre-dexed\debug\google-http-client-1.15.0-rc-e1df4461fab23a152b7aa66b5221d5c8e854fd8d.jar C:\Workspace\Android\Conex\app\build\intermediates\pre-dexed\debug\google-http-client-android-1.15.0-rc-d496a1d3909f037794a2cc73756ec0c2ac3346ea.jar C:\Workspace\Android\Conex\app\build\intermediates\pre-dexed\debug\google-http-client-jackson-1.15.0-rc-6595d29ac939c4b4e5b634f7da95f46bdaf00182.jar C:\Workspace\Android\Conex\app\build\intermediates\pre-dexed\debug\google-oauth-client-1.15.0-rc-371af28ee7d739206128093901d5ef9e5519b749.jar C:\Workspace\Android\Conex\app\build\intermediates\pre-dexed\debug\google-oauth-client-java6-1.15.0-rc-50af844006b6ff8d209e3d5c8ae5b38586f91492.jar C:\Workspace\Android\Conex\app\build\intermediates\pre-dexed\debug\internal_impl-20.0.0-c7b6cee3a8d4437effbd77e1ecb6a9d27cdb5787.jar C:\Workspace\Android\Conex\app\build\intermediates\pre-dexed\debug\jackson-core-asl-1.9.11-85252fb7001ef3b907562364baf07c747edc12f4.jar C:\Workspace\Android\Conex\app\build\intermediates\pre-dexed\debug\jsr305-1.3.9-b07eb97c334893379d7579e0a7c4b42eac8b531f.jar C:\Workspace\Android\Conex\app\build\intermediates\pre-dexed\debug\library-1.0.6-f0b390752520f3c6c5541488c776ff9e909930ea.jar C:\Workspace\Android\Conex\app\build\intermediates\pre-dexed\debug\support-annotations-20.0.0-5d7e4cb3743aa3140da033e815058188449d4cce.jar C:\Workspace\Android\Conex\app\build\intermediates\pre-dexed\debug\support-v4-r7-d8c1273a1566346364957be294afebac8a389992.jar
Error Code:
    2
Output:
    UNEXPECTED TOP-LEVEL EXCEPTION:
    com.android.dex.DexException: Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImpl;
        at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:594)
        at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:552)
        at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:533)
        at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:170)
        at com.android.dx.merge.DexMerger.merge(DexMerger.java:188)
        at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:439)
        at com.android.dx.command.dexer.Main.runMonoDex(Main.java:287)
        at com.android.dx.command.dexer.Main.run(Main.java:230)
        at com.android.dx.command.dexer.Main.main(Main.java:199)
        at com.android.dx.command.Main.main(Main.java:103)
Information:BUILD FAILED
Information:Total time: 1 mins 4.713 secs
Information:1 error
Information:0 warnings
Information:See complete output in console

问题是什么,可能是支持库重复。我怎么解决这个问题?

由于

0 个答案:

没有答案