簡體   English   中英

將ListViewAnimations添加到android項目時出現問題

[英]Problems adding ListViewAnimations to android project

我正在嘗試將庫https://github.com/nhaarman/ListViewAnimations添加到我的android項目中,但無法正常工作。 同步gradle可以正常工作,但是在編譯時出現以下錯誤:

.
.
.
:AoEu:generateDebugSources UP-TO-DATE
:AoEu:compileDebugJava UP-TO-DATE
:AoEu:preDexDebug UP-TO-DATE
:AoEu:dexDebug
UNEXPECTED TOP-LEVEL EXCEPTION:
Error:Execution failed for task ':AoEu:dexDebug'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
    /Applications/Android Studio.app/sdk/build-tools/android-4.4W/dx --dex --num-threads=4 --output /Users/daniel/Documents/code/aoeu/Android_2/AoEu/build/intermediates/dex/debug /Users/daniel/Documents/code/aoeu/Android_2/AoEu/build/intermediates/classes/debug /Users/daniel/Documents/code/aoeu/Android_2/AoEu/build/intermediates/dependency-cache/debug /Users/daniel/Documents/code/aoeu/Android_2/AoEu/build/intermediates/pre-dexed/debug/acra-4.3.0-b1a053ff2be3ad0658e7414c9efb8db525d279e1.jar /Users/daniel/Documents/code/aoeu/Android_2/AoEu/build/intermediates/pre-dexed/debug/android-async-http-1.4.4-5a7d308e504ef524369d10df7ad6b18d2333a474.jar /Users/daniel/Documents/code/aoeu/Android_2/AoEu/build/intermediates/pre-dexed/debug/annotations-12.0-f2c0a1768643eb7fbcddd7f90bd7fdcf4b535025.jar /Users/daniel/Documents/code/aoeu/Android_2/AoEu/build/intermediates/pre-dexed/debug/classes-0f154ba1813ed5f2748c80e42224f29d69f31319.jar /Users/daniel/Documents/code/aoeu/Android_2/AoEu/build/intermediates/pre-dexed/debug/classes-2ab91006f92af352b41fd4a9cf08b90ebc384663.jar /Users/daniel/Documents/code/aoeu/Android_2/AoEu/build/intermediates/pre-dexed/debug/classes-308ca14b92a9fbc70b6a0c8040e145491fe009db.jar /Users/daniel/Documents/code/aoeu/Android_2/AoEu/build/intermediates/pre-dexed/debug/classes-30ff1a32817de610075def282e38c869b04a28dc.jar /Users/daniel/Documents/code/aoeu/Android_2/AoEu/build/intermediates/pre-dexed/debug/classes-367f4c8350acbcca39b062f9298b4706d303d64e.jar /Users/daniel/Documents/code/aoeu/Android_2/AoEu/build/intermediates/pre-dexed/debug/classes-51e92b8a83db801d712dc0a6700756d222ff3d7c.jar /Users/daniel/Documents/code/aoeu/Android_2/AoEu/build/intermediates/pre-dexed/debug/classes-954a78d07e1cba7e60b32fc998618db2b73536e5.jar /Users/daniel/Documents/code/aoeu/Android_2/AoEu/build/intermediates/pre-dexed/debug/classes-95ba17748132eea2f6b9fe72f64146a711039a2e.jar /Users/daniel/Documents/code/aoeu/Android_2/AoEu/build/intermediates/pre-dexed/debug/classes-98f64520cfb53411ed06a971922b9136a7f886db.jar /Users/daniel/Documents/code/aoeu/Android_2/AoEu/build/intermediates/pre-dexed/debug/classes-9ad84293ee46c4d1204f00c5a365ece1f451993d.jar /Users/daniel/Documents/code/aoeu/Android_2/AoEu/build/intermediates/pre-dexed/debug/classes-9f06efdb2c5340fb2b4c90881246b07488331f61.jar /Users/daniel/Documents/code/aoeu/Android_2/AoEu/build/intermediates/pre-dexed/debug/classes-ac9167c19813fd3034915e682cabd31010f5aea8.jar /Users/daniel/Documents/code/aoeu/Android_2/AoEu/build/intermediates/pre-dexed/debug/classes-accd233c53f9d41450f400d9af655aba4e024959.jar /Users/daniel/Documents/code/aoeu/Android_2/AoEu/build/intermediates/pre-dexed/debug/classes-b366d899959a2cce72d0209dc8cd82ba6acfc51c.jar /Users/daniel/Documents/code/aoeu/Android_2/AoEu/build/intermediates/pre-dexed/debug/classes-bd9b360242c9c5d28979cc9db28b5b6d13d5adf9.jar /Users/daniel/Documents/code/aoeu/Android_2/AoEu/build/intermediates/pre-dexed/debug/classes-beb603821493ae18d2e211c4ebc15c24d939288f.jar /Users/daniel/Documents/code/aoeu/Android_2/AoEu/build/intermediates/pre-dexed/debug/classes-c3e39f4f328039d2cfa6a50202a0dd905bb28947.jar /Users/daniel/Documents/code/aoeu/Android_2/AoEu/build/intermediates/pre-dexed/debug/classes-c432d4669d088a374e8c2f646918795e6afd502e.jar /Users/daniel/Documents/code/aoeu/Android_2/AoEu/build/intermediates/pre-dexed/debug/classes-e40aab9c8425cb5480d94955ff39b94eba0673fe.jar /Users/daniel/Documents/code/aoeu/Android_2/AoEu/build/intermediates/pre-dexed/debug/classes-e5cf02936df1867bef02bb7eba9cf7e782f8f580.jar /Users/daniel/Documents/code/aoeu/Android_2/AoEu/build/intermediates/pre-dexed/debug/classes-e6d28e65693575cc752648484d16f78af3e72109.jar /Users/daniel/Documents/code/aoeu/Android_2/AoEu/build/intermediates/pre-dexed/debug/classes-ed9e48e9155c614bf3fa9c35be086555a10775ac.jar /Users/daniel/Documents/code/aoeu/Android_2/AoEu/build/intermediates/pre-dexed/debug/commons-io-1.3.2-5123b7dd8aac03253c765cf8fdc5e64bd1d87e62.jar /Users/daniel/Documents/code/aoeu/Android_2/AoEu/build/intermediates/pre-dexed/debug/commons-lang3-3.3.2-2c464519455a1eb9cdda46245fc20ffc1add2f52.jar /Users/daniel/Documents/code/aoeu/Android_2/AoEu/build/intermediates/pre-dexed/debug/disklrucache-2.0.2-a9c89aae05bf7016b5926b3c62ece24b06cfd098.jar /Users/daniel/Documents/code/aoeu/Android_2/AoEu/build/intermediates/pre-dexed/debug/internal_impl-20.0.0-b6e3d4dce38e3b09e28016e8db8e4ae1bb763024.jar /Users/daniel/Documents/code/aoeu/Android_2/AoEu/build/intermediates/pre-dexed/debug/lib-core-3.0.0-70b1696546add9933c9d0ae0be680ebb68143b3e.jar /Users/daniel/Documents/code/aoeu/Android_2/AoEu/build/intermediates/pre-dexed/debug/library-2.4.0-8bb96134963e47cabbae008ca69e322b1f133527.jar /Users/daniel/Documents/code/aoeu/Android_2/AoEu/build/intermediates/pre-dexed/debug/okhttp-1.6.0-0cf0746018b0646a0e162fd0629520e2fbb998d1.jar /Users/daniel/Documents/code/aoeu/Android_2/AoEu/build/intermediates/pre-dexed/debug/okhttp-urlconnection-1.6.0-d1ddb162604ccb14c556bd8d52c46ce1abd8f372.jar /Users/daniel/Documents/code/aoeu/Android_2/AoEu/build/intermediates/pre-dexed/debug/support-annotations-21.0.0-rc1-9da56907a54bc62b80b021d0066dc3e5625c73ba.jar /Users/daniel/Documents/code/aoeu/Android_2/AoEu/build/intermediates/pre-dexed/debug/universal-image-loader-1.9.1-c662c9896a82f0f3822fee3cb4d5ab8000983974.jar
  Error Code:
    2
  Output:
    UNEXPECTED TOP-LEVEL EXCEPTION:
    com.android.dex.DexException: Multiple dex files define Lcom/nhaarman/listviewanimations/BaseAdapterDecorator;
        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: 24.587 secs
Information:1 error
Information:0 warnings
Information:See complete output in console

我已經嘗試了該庫的3.0版本和maven和.jar的2.6.0,並且仍然是相同的錯誤。 還嘗試清理和重建項目。 任何人都對可能出什么問題以及如何解決問題有任何建議?

我的build.gradle

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.12.+'
     }
}
apply plugin: 'com.android.application'

repositories {
    mavenCentral()
    maven {
        name 'maven.aviary.com'
        url uri("http://maven.aviary.com/repo/release")
    }
}

android {
    compileSdkVersion 20
    buildToolsVersion '20'

    defaultConfig {
        minSdkVersion 14
        targetSdkVersion 20
    }

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

}

dependencies {
    compile 'com.github.chrisbanes.actionbarpulltorefresh:library:+'
    compile 'com.android.support:support-v4:20.+'
    compile 'com.google.android.gms:play-services:4.4.52'
    compile 'ch.acra:acra:4.3.0'
    compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.1'
    compile 'com.loopj.android:android-async-http:1.4.4'
    compile 'com.github.johnkil.android-appmsg:appmsg:1.2.0'
    compile 'com.aviary.android.feather.sdk:aviary-sdk:3.4.3.351'
    compile 'com.nhaarman.listviewanimations:lib-core:3.0.+'
}

更新-解決了,謝謝! 我將jarjar與本文一起使用來解決該問題。

我似乎Aviary SDK包括零件listviewanimations。

我建議您向Aviary提交錯誤。

在他們修復它之前,您可以使用jarjar來移動包com.nhaarman。 到另一個包裝。

參考文獻:

https://code.google.com/p/jarjar/

https://github.com/vRallev/jarjar-gradle

https://gist.github.com/mcholick/7177513

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM