android - 重复库 gradle animatorlistener 重复

标签 android gradle

我正在尝试在我的 android 项目中使用一些库,但我在使用不同的库时遇到了一些问题。我有一个从具有“nineoldandroids”库依赖项的 Maven 存储库导入的库。之后我有另一个使用相同库的导入,我排除了那个模块。现在,如果我同步 Gradle,一切正常,但是当我尝试运行我的应用程序时,出现以下错误

"Error:Class com.nineoldandroids.animation.Animator.AnimatorListener has already been added to output. Please remove duplicate copies."

我认为这两个库都在尝试使用相同的 Listener,我收到了该错误,但我无法解决它,也没有找到对我有用的信息。如果有人可以帮助我,我将不胜感激。这是我的 gradle 文件。顺便说一句,必须手动包含最后一个库,并将其放置在我的“libs”文件夹中。

apply plugin: 'com.android.application'

android {
    compileSdkVersion 21
    buildToolsVersion "21.1.1"

    defaultConfig {
        applicationId "com.infortec.acostela.pescamerca"
        minSdkVersion 19
        targetSdkVersion 21
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    repositories{
        jcenter()
        flatDir {
           dirs 'libs'
        }
    }
    dexOptions {
        preDexLibraries = false
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.android.support:appcompat-v7:21.0.+'
    compile "com.android.support:gridlayout-v7:18.0.+"
    compile 'com.j256.ormlite:ormlite-core:4.48'
    compile 'com.j256.ormlite:ormlite-android:4.48'
    compile 'commons-net:commons-net:3.3'
    compile 'net.sf.opencsv:opencsv:2.3'
    compile 'com.rengwuxian.materialedittext:library:1.8.2'
    compile ('libs.example:material:0.4.3@aar'){
        exclude module: 'nineoldandroids'
    }
 }

最佳答案

终于解决了。

问题是我必须排除整个库,而不仅仅是模块,因此编写以下内容解决了它。

compile ('com.rengwuxian.materialedittext:library:1.8.2'){
    exclude group: 'com.nineoldandroids', module: 'library'
}

关于android - 重复库 gradle animatorlistener 重复,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28297249/

相关文章:

Android ExpandableListView 指示器/图标总是拉伸(stretch)

android - 如何最好地将大型应用程序划分为模块?

android - ActionBarSherlock AndroidManifest.xml 和导入时丢失的其他文件

java - 平板电脑 - 获取可绘制的屏幕分辨率,而不是总屏幕分辨率

plugins - 在Gradle中设置作为编译配置父级的配置

Android如何根据背景图片改变文字颜色

android - 如何将外部模块添加到 Intellij IDEA 14 中的 gradle 项目?

android - 如何从android库中删除一些可绘制的密度

android - 错误 : fix the version conflict (google-services plugin) using productFlavors

android - ArrayAdapter - 获取列表项的给定资源 ID