IllegalArgumentException:已经添加:Landroid / support / v4 / accessibilityservice / AccessibilityServiceInfoCompat $ AccessibilityServiceInfoIcsImpl; [英] IllegalArgumentException: already added: Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoIcsImpl;

查看:835
本文介绍了IllegalArgumentException:已经添加:Landroid / support / v4 / accessibilityservice / AccessibilityServiceInfoCompat $ AccessibilityServiceInfoIcsImpl;的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在MyProject + Facebook api上使用Android Studio + gradle作为库。请参阅下面的设置。



我尝试删除support-v4(r7或18.0.0)的所有引用,并将其替换为support-v13,但消息与第4版仍然存在。我也注意到support-v4-r7出现在外部库中,即使它在任何地方都没有被引用。这是问题吗?



MyProject build.gradle:

  buildscript {
repositories {
mavenCentral()
}
依赖关系{
classpath'com.android.tools.build:gradle:0.5 。+'
}
}
apply plugin:'android'

repositories {
mavenCentral()
maven {
urlhttps://raw.github.com/ark/ark/master/releases/
}
}

依赖项{
compile'c​​om.andreabaccega :android-form-edittext:1.0.3'
compile'c​​om.astuetz:pagerslidingtabstrip:1.0.0'
compile'org.codehaus.jackson:jackson-mapper-asl:1.9.12'
compile'c​​om.octo.android.robospice:robospice-spring-android:1.4.7'
compile'c​​om.google.android.gms:play-services:3.1.36'
compile文件('libs / imageloader-core-1.5.8.jar')
编译项目(':libs:Facebook')

}

android {
compileSdkVersion 17
buildToolsVersion18.1

defaultConfig {
minSdkVersion 15
targetSdkVersion 17
}
sourceSets {
main {
manifest.srcFile'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['res']
res.srcDirs = ['res']
}

debug {
manifest.srcFile'AndroidManifest.xml'
java.srcDirs = ['src','libs / Facebook / src','libs / Facebook / build / source / r / debug','libs / Facebook / build / source / buildConfig / debug']
resources.srcDirs = ['build','libs / Facebook / build / source / r / debug','libs / Facebook / build / source / buildConfig / debug']
res.srcDirs = ['res']
}
}
}

MyProject settings.gradle:

  include':MyProject'
include':libs:Facebook'

Facebook建立.gradle:

  buildscript {
存储库{
mavenCentral()
}
dependencies {
classpath'com.android.tools.build:gradle:0.5.+'
}
}
apply plugin:'android-library'

知识库{
mavenCentral()
}

依赖关系{
compile'c​​om.android.support:support-v4:18.0.0 '
}

android {
compileSdkVersion 17
buildToolsVersion '18 .1'

defaultConfig {
minSdkVersion 8
}
$ b $ sourceSets {
main {
manifest.srcFile'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['res']
res.srcDirs = ['res']
}
debug {
manifest.srcFile'AndroidManifest.xml
java.srcDirs = ['src','build / source / r / debug','build / source / buildConfig / debug']
resources.srcDirs = ['build / source / r / debug ','build / source / buildConfig / debug']
res.srcDirs = ['res']
}
}
}

编辑:我试过在另一个项目中逐个添加我在此项目中使用的库,看看失败了。显然这2个是罪魁祸首。如果我包含它们中的任何一个或两个,我会得到上述错误。

  compile'c​​om.astuetz:pagerslidingtabstrip:1.0.0 '
compile'c​​om.google.android.gms:play-services:3.1.36'

关于如何管理它的任何想法?



Edit2:显然另一个项目会出现同样的问题。请参阅下面的build.gradle依赖关系。 StickyListHeaders项目不包含任何依赖关系。所以我认为这是因为ActionBarSherlock?

 依赖关系{
compile'c​​om.actionbarsherlock:actionbarsherlock:4.4.0 @ aar'
compile'c​​om.android.support:support-v4:18.0.+'
compile'org.codehaus.jackson:jackson-mapper-asl:1.9.12'
compile' com.octo.android.robospice:robospice-spring-android:1.4.7'
compile project(':Project Base:libs:StickyListHeaders')
}


解决方案

显然这个问题有两个原因。 1)PagerSlidingTabStrip库依赖于本地支持的lib v4 jar。删除依赖项并将项目添加为应用程序中的库项目,并在其中添加支持v4的Maven依赖项。所以它看起来应该和上面的Facebook库项目完全一样。


$ b 2)RoboSpice库依赖于支持lib v4的LRUCache( https://github.com/octo-online/robospice/issues/195 )。

  compile('com.octo.android .robospice:robospice-spring-android:1.4.7')
{
排除模块:'support-v4'
}

希望这会帮助某人,而不是像我一样花费整整一周的时间来处理这个问题。哦,万亿感谢@Snicolas。如果没有他的帮助,不能解决它。

编辑:从RoboSpice v1.4.8开始,没有更多的本地支持lib依赖项,所以这个问题是固定的。 / p>

I'm using Android Studio + gradle on MyProject + Facebook api as a library. See below settings.

I've tried removing all references of support-v4 (either r7 or 18.0.0) and replace them with support-v13, but the message with v4 was still present. I've also noticed that support-v4-r7 appears in External libraries, even though it's not referenced at all, anywhere. Would that be the problem ?

MyProject build.gradle:

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

repositories {
    mavenCentral()
    maven {
        url "https://raw.github.com/ark/ark/master/releases/"
    }
}

dependencies {
    compile 'com.andreabaccega:android-form-edittext:1.0.3'
    compile 'com.astuetz:pagerslidingtabstrip:1.0.0'
    compile 'org.codehaus.jackson:jackson-mapper-asl:1.9.12'
    compile 'com.octo.android.robospice:robospice-spring-android:1.4.7'
    compile 'com.google.android.gms:play-services:3.1.36'
    compile files('libs/imageloader-core-1.5.8.jar')
    compile project(':libs:Facebook')

}

android {
    compileSdkVersion 17
    buildToolsVersion "18.1"

    defaultConfig {
        minSdkVersion 15
        targetSdkVersion 17
    }
    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
            java.srcDirs = ['src']
            resources.srcDirs = ['res']
            res.srcDirs = ['res']
        }

        debug {
            manifest.srcFile 'AndroidManifest.xml'
            java.srcDirs = ['src', 'libs/Facebook/src', 'libs/Facebook/build/source/r/debug', 'libs/Facebook/build/source/buildConfig/debug']
            resources.srcDirs = ['build', 'libs/Facebook/build/source/r/debug', 'libs/Facebook/build/source/buildConfig/debug']
            res.srcDirs = ['res']
        }
    }
}

MyProject settings.gradle:

include ':MyProject'
include ':libs:Facebook'

Facebook build.gradle:

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

repositories {
    mavenCentral()
}

dependencies {
    compile 'com.android.support:support-v4:18.0.0'
}

android {
  compileSdkVersion 17
  buildToolsVersion '18.1'

    defaultConfig {
        minSdkVersion 8
    }

  sourceSets {
    main {
        manifest.srcFile 'AndroidManifest.xml'
        java.srcDirs = ['src']
        resources.srcDirs = ['res']
        res.srcDirs = ['res']
    }
      debug {
          manifest.srcFile 'AndroidManifest.xml'
          java.srcDirs = ['src', 'build/source/r/debug', 'build/source/buildConfig/debug']
          resources.srcDirs = ['build/source/r/debug', 'build/source/buildConfig/debug']
          res.srcDirs = ['res']
      }
  }
}

Edit: I've tried adding the libs that I use in this project, in another project, one by one, to see what fails. Apparently these 2 are the culprits. If I include any or both of them, I get the above error.

compile 'com.astuetz:pagerslidingtabstrip:1.0.0'
compile 'com.google.android.gms:play-services:3.1.36'

Any ideas on how to manage this ?

Edit2: Apparently another project presents the same issue. See build.gradle dependencies below. StickyListHeaders project doesn't contain anymore dependencies. So I presume it's because of ActionBarSherlock ?

dependencies {
    compile 'com.actionbarsherlock:actionbarsherlock:4.4.0@aar'
    compile 'com.android.support:support-v4:18.0.+'
    compile 'org.codehaus.jackson:jackson-mapper-asl:1.9.12'
    compile 'com.octo.android.robospice:robospice-spring-android:1.4.7'
    compile project(':Project Base:libs:StickyListHeaders')
}

解决方案

Apparently there were 2 reasons for this issue.

1) PagerSlidingTabStrip library depends on a local support lib v4 jar. Remove the dependency and add the project as a library project in your app and inside it add the maven dependency for support v4. So it should look exactly like the Facebook library project from above.

2) RoboSpice library depends on LRUCache from support lib v4 (https://github.com/octo-online/robospice/issues/195). Just exclude it from your main build.gradle file and you should be good to go.

compile ('com.octo.android.robospice:robospice-spring-android:1.4.7')
        {
            exclude module: 'support-v4'
        }

Hopefully this will help somebody and not spend an entire week with this problem like I did. Oh, and trillion of thanks to @Snicolas. Couldn't have solved it without his help.

Edit: As of RoboSpice v1.4.8, there is no more local support lib dependency, so this issue is fixed.

这篇关于IllegalArgumentException:已经添加:Landroid / support / v4 / accessibilityservice / AccessibilityServiceInfoCompat $ AccessibilityServiceInfoIcsImpl;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆