在路径上未找到类"android.support.v7.internal.widget.TintManager":DexPathList

10

我已将支持库更新至版本23.0.1,然后开始遇到这个错误。

在路径DexPathList上未找到类"android.support.v7.internal.widget.TintManager"。

我在应用程序中使用了许多第三方库。这会导致此问题吗?

Gradle文件:

   apply plugin: 'com.android.application'

repositories {
    mavenCentral()
    maven { url 'http://maven.stickerpipe.com/artifactory/stickerfactory' }
}

android {
    compileSdkVersion 23
    buildToolsVersion '23.0.1'

    defaultConfig {
        applicationId "xxxxxxxxx"
        minSdkVersion 16
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    packagingOptions {
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE-FIREBASE.txt'
        exclude 'META-INF/NOTICE'
    }
    dexOptions {
        incremental true
        javaMaxHeapSize "4g"
    }
}

dependencies {
    apply plugin: 'com.google.gms.google-services'
    compile 'com.google.android.gms:play-services:8.1.0'
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'de.hdodenhof:circleimageview:1.2.1'
    compile 'com.android.support:recyclerview-v7:23.0.1'
    compile 'com.android.support:appcompat-v7:23.0.1'
    compile 'com.journeyapps:zxing-android-embedded:3.0.1@aar'
    compile 'com.google.zxing:core:3.2.0'
    compile 'com.android.support:design:23.0.1'
    compile 'com.squareup.picasso:picasso:2.4.0'
    compile 'com.squareup.okhttp:okhttp-urlconnection:2.2.0'
    compile('com.github.ganfra:material-spinner:1.1.0') {
        exclude group: 'com.android.support', module: 'appcompat-v7'
    }
    compile 'com.cesarferreira.colorize:library:0.2.1'
    compile 'com.instabug.library:instabugsupport:1+'
    compile('vc908.stickers:stickerfactory:0.2.2@aar') {
        transitive = true;
    }
    compile 'com.android.support:multidex:1.0.0'
    compile('com.mixpanel.android:mixpanel-android:4.6.4')
            {
                exclude group: 'com.android.support', module: 'appcompat-v7'
            }
}
6个回答

21

我在升级到Android Studio 2.0之后遇到了相同的问题。我更新了未更新的依赖项,现在它正在正常运行。

通过交叉引用我们的gradle文件,我认为您需要更新您的设计支持库:

compile 'com.android.support:design:23.1.1'

11

我将appcompat-v7从以下版本进行了降级:

compile 'com.android.support:appcompat-v7:23.1.1'

到以下版本:

compile 'com.android.support:appcompat-v7:23.1.0'

这样就可以正常工作了。


4

有人建议设置更高版本,而有人则说要设置更低版本。这是因为即使你定义为 23.1.1,Gradle 会 默默地 使用更高的版本。(此时,它使用 24.0.1 进行编译)

我建议你通过运行 gradlew app:dependencies -q 命令来检查所涉及的正确版本。

要解决其上限版本问题,请按如下所示将 force = true 设置为所有支持库。

compile ('com.android.support:support-v4:23.1.1'){
    force = true;
}
compile ('com.android.support:appcompat-v7:23.1.1'){
    force = true;
}
compile ('com.android.support:design:23.1.1'){
    force = true;
}
compile ('com.android.support:cardview-v7:23.1.1'){
    force = true;
}
compile ('com.android.support:recyclerview-v7:23.1.1'){
    force = true;
}

1
我确保在所有地方都使用了相同的支持库版本(24.0.0),但直到我用AppCompatDrawableManager替换了所有使用TintManager的地方,它才起作用。 看起来他们已经用AppCompatDrawableManager替换了TintManager,因为这里 AppCompatDrawableManager仍然有标签TintManager。 - shtolik

1

有些库和工具的组合是不兼容的,或者可能会导致错误。其中一个不兼容性是使用非最新版本的android-support库进行编译(特别是低于目标sdk版本的版本)。


0
当在ViewPager中使用选项卡时,会引起问题:因此,为了解决它,请尝试将您的support:appcompat-v7版本降级到23.2.0,或者只减少一位就可以了。我找到了解决方案,希望你也能够解决它。 :)

0

Support V4库是Android支持库的基础,包含许多专注于使向后兼容变得更加容易的类。

尝试添加

com.android.support:support-v4:23.1.0

尝试过了,但是没有起作用。仍然得到相同的错误。 - shravan reddy

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接