在android studio 1.0.2中包含库时出错

时间:2015-02-06 08:27:37

标签: android android-library

我试图在我的项目enter link description here中导入浮动按钮库 我在构建以下内容时遇到错误

Error:No such property: GROUP for class: org.gradle.api.publication.maven.internal.ant.DefaultGroovyMavenDeployer

我搜索了stackoverflow,其中一个解决方案建议对该行进行评论

apply from: './gradle-mvn-push.gradle'

然后,项目成功构建,但在执行时出错

Error:Execution failed for task ':app:dexDebug'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
    C:\Users\GUJAR\AppData\Local\Android\sdk\build-tools\21.1.2\dx.bat --dex --no-optimize --output C:\Users\GUJAR\AndroidStudioProjects\MyApplication\app\build\intermediates\dex\debug --input-list=C:\Users\GUJAR\AndroidStudioProjects\MyApplication\app\build\intermediates\tmp\dex\debug\inputList.txt
Error Code:
    2
Output:
    UNEXPECTED TOP-LEVEL EXCEPTION:
    com.android.dex.DexException: Multiple dex files define Lcom/getbase/floatingactionbutton/AddFloatingActionButton$1;
        at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596)
        at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554)
        at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535)
        at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
        at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
        at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:454)
        at com.android.dx.command.dexer.Main.runMonoDex(Main.java:303)
        at com.android.dx.command.dexer.Main.run(Main.java:246)
        at com.android.dx.command.dexer.Main.main(Main.java:215)
        at com.android.dx.command.Main.main(Main.java:106)

依赖性:

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:21.0.3'
    compile 'com.android.support:support-v4:21.0.3'
    compile project(':floatingbutton')
}

帮帮我......

1 个答案:

答案 0 :(得分:0)

UNEXPECTED TOP-LEVEL EXCEPTION通常发生在包含同一个库的多个版本且gradle因此而发生冲突的情况下。 例如,如果您的应用程序build.gradle中有一些库,并且库项目的build.gradle中的maven依赖项与库相同,反之亦然,那么您将收到此错误。看看这个案例。