android 报错: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v4/animation/Anim...

在使用SmartRefreshLayout时,报 java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v4/animation/AnimatorCompatHelper;的错误,

如下图:

android 报错: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v4/animation/Anim..._第1张图片

在开发过程中,有的时候引入了多个三方库.在调用的时候会出现版本对应不上的原因,需要强制版本号统一

解决办法,在app和Module: Library的build.gradle添加如下代码

configurations.all {
    resolutionStrategy.eachDependency { DependencyResolveDetails details ->
        def requested = details.requested
        if (requested.group == 'com.android.support') {
            if (!requested.name.startsWith("multidex")) {
                details.useVersion '25.3.0'
            }
        }
    }
}

 如图:

android 报错: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v4/animation/Anim..._第2张图片

转载于:https://www.cnblogs.com/changyiqiang/p/10267308.html

你可能感兴趣的:(android 报错: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v4/animation/Anim...)