IllegalArgumentException:已补充道:Landroid /支持/ v4 / accessibilityservice AccessibilityServiceInfoCompat AccessibilityServiceInfoIcsImpl美元;

时间:2022-09-03 22:31:13

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

我使用Android Studio + gradle on项目+ Facebook api作为库。参见下面的设置。

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 ?

我尝试删除所有support-v4 (r7或18.0.0)的引用,并用support-v13替换它们,但是v4的消息仍然存在。我还注意到,supportv4 -r7出现在外部库中,尽管它在任何地方都没有被引用。这就是问题所在吗?

MyProject build.gradle:

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:

MyProject settings.gradle:

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

Facebook build.gradle:

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.

编辑:我试过添加我在这个项目中使用的lib,在另一个项目中,一个接一个,看看有什么失败。显然这两个是罪魁祸首。如果我包含其中的任何一个或两个,我得到上面的错误。

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 ?

显然另一个项目也有同样的问题。看到构建。它下面的依赖关系。stickylistheader项目不再包含依赖项。所以我猜是因为行动吧,夏洛克?

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')
}

6 个解决方案

#1


9  

For anyone who happens to hit this error while using Visual Studio with Xamarin, like I did;

对于任何在使用Xamarin的Visual Studio时碰巧遇到这个错误的人,比如我;

I solved it by simply removing the reference to "Xamarin.Android.Support.v4" from the References folder within the project, then cleaned and built project as normal.

我通过删除对“Xamarin.Android.Support”的引用来解决这个问题。从项目中的引用文件夹中获取v4,然后像往常一样清理和构建项目。

#2


7  

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.

1) PagerSlidingTabStrip库依赖于本地支持lib v4 jar。删除依赖项并将项目添加为应用程序中的库项目,并在其中添加maven依赖项以支持v4。所以它看起来应该和上面的Facebook图书馆项目一模一样。

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.

2) RoboSpice程序库依赖于来自支持lib v4的LRUCache (https://github.com/octo-online/robospice/issues/195)。把它从主构建中排除。格列文件,你该走了。

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.

希望这能对大家有所帮助而不是像我一样花一整周的时间来解决这个问题。感谢@Snicolas。没有他的帮助是解决不了问题的。

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

编辑:对于RoboSpice v1.4.8,没有更多的本地支持库依赖项,因此这个问题得到了解决。

#3


1  

Run "gradle androidDependencies" and check your dependencie tree. Add an exclude for the modules that are overlapped.

运行“android依赖”并检查您的依赖树。为重叠的模块添加一个排除。

For example i had to do the following:

例如,我必须做以下事情:

dependencies {
  compile 'com.google.android:support-v4:r7'
  compile project(':libraries:actionbarsherlock')
  compile ('com.github.chrisbanes.actionbarpulltorefresh:extra-abs:+') {
    // Need to specifically exclude this as it is specified in our own project
    exclude module: 'actionbarsherlock'
    exclude module: 'support-v4'
  }
}

#4


1  

When this is for Xamarin.Android, this error occurs for version mismatching between depended packages. You've got to remove this Xamarin.Android.Support.v4 package from the project along with other mismatching packages. (What does mismatching means here is, if your target Android version is Android 6, all packages listed in the packages.config file should have targetFramework="monoandroid60" packages. If any package won't abide this, it's a mismatching version). If you have messed with versions, then removing the reference and cleaning stuff alone won't work. You've got to remove all the mismatching packages from the Nuget Package Manager (Tools > NuGet Package Manager > Manage NuGet Packages for Solution...). Note that when you're to remove these packages, you'll also need to remove the depended packages. No harm go ahead and remove them all and you can re-install them with the correct version.

这是给海蓝宝石的。Android,这个错误发生在不同包之间的版本不匹配。你得去掉这个海蓝宝石,安卓,支持。项目中的v4包以及其他不匹配的包。(错误匹配的意思是,如果你的目标Android版本是Android 6,所有包都列在包中。配置文件应该有targetFramework=“monoandroid60”包。如果有任何软件包不能忍受这个,这是一个不匹配的版本)。如果您把版本搞混了,那么仅删除引用和清理内容是行不通的。您必须从Nuget包管理器中删除所有的错误匹配包(工具> Nuget包管理器>管理Nuget包以获得解决方案…)。注意,当您要删除这些包时,您还需要删除相关的包。没有危害,继续并删除他们所有,你可以重新安装他们与正确的版本。

Once you've removed the package along with the dependent packages, try building the project. After a successful build, re-install the packages from the Nuget Package Manager with the correct version. (Package versions are listed according to the API levels, Ex: Android 6 which is API 23, would support packages of version 23.x.x)

一旦您删除了包和相关包,尝试构建项目。成功构建之后,使用正确的版本重新安装Nuget包管理器中的包。(包版本是根据API级别列出的,例如:Android 6是API 23,支持23.x.x版本的包)

Cleanup the project and build it, hopefully it'll succeed building!

清理项目并构建它,希望它能够成功构建!

Hope this'll help cleanup the mess!

希望这将有助于清理混乱!

#5


0  

The page slider library also have support library dependency. Thus you are getting this error. In case of maven all you need to do is change your main project pom file dependency entry of the support library to scope as provided.

页面滑块库也支持库依赖。因此你会得到这个错误。在maven的情况下,您所需要做的就是将支持库的主项目pom文件依赖项更改为所提供的范围。

<dependency>
    <groupId>android.support</groupId>
    <artifactId>compatibility-v4</artifactId>
    <version>13</version>
    <scope>provided</scope>
</dependency>

In case of gradle i think you need to change the dependency configuration to match maven provided scope

对于gradle,我认为您需要更改依赖配置以匹配maven提供的范围

Please refer the following link for more details Convert Maven to Gradle

有关将Maven转换为Gradle的更多细节,请参考以下链接

#6


-2  

Remove all old reference .dlls and relevant to that and add again from NuGet.

删除所有旧的引用。dll和相关的,并再次添加从NuGet。

#1


9  

For anyone who happens to hit this error while using Visual Studio with Xamarin, like I did;

对于任何在使用Xamarin的Visual Studio时碰巧遇到这个错误的人,比如我;

I solved it by simply removing the reference to "Xamarin.Android.Support.v4" from the References folder within the project, then cleaned and built project as normal.

我通过删除对“Xamarin.Android.Support”的引用来解决这个问题。从项目中的引用文件夹中获取v4,然后像往常一样清理和构建项目。

#2


7  

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.

1) PagerSlidingTabStrip库依赖于本地支持lib v4 jar。删除依赖项并将项目添加为应用程序中的库项目,并在其中添加maven依赖项以支持v4。所以它看起来应该和上面的Facebook图书馆项目一模一样。

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.

2) RoboSpice程序库依赖于来自支持lib v4的LRUCache (https://github.com/octo-online/robospice/issues/195)。把它从主构建中排除。格列文件,你该走了。

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.

希望这能对大家有所帮助而不是像我一样花一整周的时间来解决这个问题。感谢@Snicolas。没有他的帮助是解决不了问题的。

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

编辑:对于RoboSpice v1.4.8,没有更多的本地支持库依赖项,因此这个问题得到了解决。

#3


1  

Run "gradle androidDependencies" and check your dependencie tree. Add an exclude for the modules that are overlapped.

运行“android依赖”并检查您的依赖树。为重叠的模块添加一个排除。

For example i had to do the following:

例如,我必须做以下事情:

dependencies {
  compile 'com.google.android:support-v4:r7'
  compile project(':libraries:actionbarsherlock')
  compile ('com.github.chrisbanes.actionbarpulltorefresh:extra-abs:+') {
    // Need to specifically exclude this as it is specified in our own project
    exclude module: 'actionbarsherlock'
    exclude module: 'support-v4'
  }
}

#4


1  

When this is for Xamarin.Android, this error occurs for version mismatching between depended packages. You've got to remove this Xamarin.Android.Support.v4 package from the project along with other mismatching packages. (What does mismatching means here is, if your target Android version is Android 6, all packages listed in the packages.config file should have targetFramework="monoandroid60" packages. If any package won't abide this, it's a mismatching version). If you have messed with versions, then removing the reference and cleaning stuff alone won't work. You've got to remove all the mismatching packages from the Nuget Package Manager (Tools > NuGet Package Manager > Manage NuGet Packages for Solution...). Note that when you're to remove these packages, you'll also need to remove the depended packages. No harm go ahead and remove them all and you can re-install them with the correct version.

这是给海蓝宝石的。Android,这个错误发生在不同包之间的版本不匹配。你得去掉这个海蓝宝石,安卓,支持。项目中的v4包以及其他不匹配的包。(错误匹配的意思是,如果你的目标Android版本是Android 6,所有包都列在包中。配置文件应该有targetFramework=“monoandroid60”包。如果有任何软件包不能忍受这个,这是一个不匹配的版本)。如果您把版本搞混了,那么仅删除引用和清理内容是行不通的。您必须从Nuget包管理器中删除所有的错误匹配包(工具> Nuget包管理器>管理Nuget包以获得解决方案…)。注意,当您要删除这些包时,您还需要删除相关的包。没有危害,继续并删除他们所有,你可以重新安装他们与正确的版本。

Once you've removed the package along with the dependent packages, try building the project. After a successful build, re-install the packages from the Nuget Package Manager with the correct version. (Package versions are listed according to the API levels, Ex: Android 6 which is API 23, would support packages of version 23.x.x)

一旦您删除了包和相关包,尝试构建项目。成功构建之后,使用正确的版本重新安装Nuget包管理器中的包。(包版本是根据API级别列出的,例如:Android 6是API 23,支持23.x.x版本的包)

Cleanup the project and build it, hopefully it'll succeed building!

清理项目并构建它,希望它能够成功构建!

Hope this'll help cleanup the mess!

希望这将有助于清理混乱!

#5


0  

The page slider library also have support library dependency. Thus you are getting this error. In case of maven all you need to do is change your main project pom file dependency entry of the support library to scope as provided.

页面滑块库也支持库依赖。因此你会得到这个错误。在maven的情况下,您所需要做的就是将支持库的主项目pom文件依赖项更改为所提供的范围。

<dependency>
    <groupId>android.support</groupId>
    <artifactId>compatibility-v4</artifactId>
    <version>13</version>
    <scope>provided</scope>
</dependency>

In case of gradle i think you need to change the dependency configuration to match maven provided scope

对于gradle,我认为您需要更改依赖配置以匹配maven提供的范围

Please refer the following link for more details Convert Maven to Gradle

有关将Maven转换为Gradle的更多细节,请参考以下链接

#6


-2  

Remove all old reference .dlls and relevant to that and add again from NuGet.

删除所有旧的引用。dll和相关的,并再次添加从NuGet。