it-swarm.com.ru

NoClassDefFoundError Android/поддержка/v4/анимация/AnimatorCompatHelper

После обновления Android Studio до 2.3.1 и gradle до 3.3 я заметил, что приложение зависает при определенной активности. До обновления все было хорошо. Я потратил впустую день на эту вещь, и я действительно не могу понять, почему я получаю A 'Java.lang.NoClassDefFoundError: Ошибка разрешения: Landroid/support/v4/animation/AnimatorCompatHelper ;» Роковое исключение.

Я загружу также самые важные части файла build.gradle

apply plugin: 'com.Android.application'

Android {
compileSdkVersion 23
buildToolsVersion Android_BUILD_TOOLS

defaultConfig {
    minSdkVersion 16
    targetSdkVersion Android_TARGET_SDK
}

signingConfigs {
    release {
       ....
    }
}

buildTypes {
    release {
       ...
    }
    debug {
        ..
    }
}

sourceSets.main {
   ..
}

flavorDimensions "abi", "countMode"
productFlavors {
    ...
}
compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_7
    targetCompatibility JavaVersion.VERSION_1_7
}

packagingOptions {
    exclude 'META-INF/LICENSE'
    exclude 'META-INF/LICENSE.txt'
    exclude 'META-INF/NOTICE'
    exclude 'META-INF/NOTICE.txt'
}
buildToolsVersion '25.0.0'
}

 repositories {
    maven {
        url "https://jitpack.io"
    }
}

dependencies {
   if (ENABLE_ABI_ARM7) armv7Compile project(path: ':countlib', configuration: 'armv7Release')
if (!USE_CUSTOM_OPENCV) {
    if (ENABLE_ABI_X86) x86Compile project(path: ':countlib', configuration: 'x86Release')
    if (ENABLE_ABI_ARM) armCompile project(path: ':countlib', configuration: 'armRelease')
    if (ENABLE_ABI_MIPS) mipsCompile project(path: ':countlib', configuration: 'mipsRelease')
}
compile project(':photoviewlib')

compile 'com.Android.support:appcompat-v7:23.1.0'
compile 'com.Android.support:design:23.1.0'
compile 'com.Android.support:recyclerview-v7:23.1.0'
compile 'com.google.Android.gms:play-services-drive:10.2.1'

// Include the sdk as a dependency
compile ('com.OneDrive.sdk:OneDrive-sdk-Android:1.2+') {
    transitive = false
}

// Include the gson dependency
compile ('com.google.code.gson:gson:2.3.1')

// Include supported authentication methods for your application
compile ('com.Microsoft.services.msa:msa-auth:0.8.+')
compile ('com.Microsoft.aad:adal:1.1.+')

// HTTP client
compile 'com.google.http-client:google-http-client-gson:1.20.0' exclude module: 'httpclient'

compile "com.github.danielnilsson9:color-picker-view:[email protected]"
compile 'com.github.crosswall:Android-Coverflow:release-v1.0.4'
compile 'com.dropbox.core:dropbox-core-sdk:2.1.2'
}

Вот полный стек исключений:

Java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v4/animation/AnimatorCompatHelper;
                                                                          at Android.support.v7.widget.DefaultItemAnimator.resetAnimation(DefaultItemAnimator.Java:513)
                                                                          at Android.support.v7.widget.DefaultItemAnimator.animateRemove(DefaultItemAnimator.Java:187)
                                                                          at Android.support.v7.widget.SimpleItemAnimator.animateDisappearance(SimpleItemAnimator.Java:86)
                                                                          at Android.support.v7.widget.RecyclerView.animateDisappearance(RecyclerView.Java:3046)
                                                                          at Android.support.v7.widget.RecyclerView.access$700(RecyclerView.Java:144)
                                                                          at Android.support.v7.widget.RecyclerView$4.processDisappeared(RecyclerView.Java:416)
                                                                          at Android.support.v7.widget.ViewInfoStore.process(ViewInfoStore.Java:201)
                                                                          at Android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.Java:2931)
                                                                          at Android.support.v7.widget.RecyclerView.onLayout(RecyclerView.Java:3071)
                                                                          at Android.view.View.layout(View.Java:17945)
                                                                          at Android.view.ViewGroup.layout(ViewGroup.Java:5812)
                                                                          at Android.widget.LinearLayout.setChildFrame(LinearLayout.Java:1742)
                                                                          at Android.widget.LinearLayout.layoutVertical(LinearLayout.Java:1585)
                                                                          at Android.widget.LinearLayout.onLayout(LinearLayout.Java:1494)
                                                                          at Android.view.View.layout(View.Java:17945)
                                                                          at Android.view.ViewGroup.layout(ViewGroup.Java:5812)
                                                                          at Android.support.design.widget.CoordinatorLayout.layoutChild(CoordinatorLayout.Java:1037)
                                                                          at Android.support.design.widget.CoordinatorLayout.onLayoutChild(CoordinatorLayout.Java:747)
                                                                          at Android.support.design.widget.ViewOffsetBehavior.onLayoutChild(ViewOffsetBehavior.Java:42)
                                                                          at Android.support.design.widget.AppBarLayout$ScrollingViewBehavior.onLayoutChild(AppBarLayout.Java:1133)
                                                                          at Android.support.design.widget.CoordinatorLayout.onLayout(CoordinatorLayout.Java:760)
                                                                          at Android.view.View.layout(View.Java:17945)
                                                                          at Android.view.ViewGroup.layout(ViewGroup.Java:5812)
                                                                          at Android.support.v4.widget.DrawerLayout.onLayout(DrawerLayout.Java:1192)
                                                                          at Android.view.View.layout(View.Java:17945)
                                                                          at Android.view.ViewGroup.layout(ViewGroup.Java:5812)
                                                                          at Android.widget.FrameLayout.layoutChildren(FrameLayout.Java:344)
                                                                          at Android.widget.FrameLayout.onLayout(FrameLayout.Java:281)
                                                                          at Android.view.View.layout(View.Java:17945)
                                                                          at Android.view.ViewGroup.layout(ViewGroup.Java:5812)
                                                                          at Android.widget.LinearLayout.setChildFrame(LinearLayout.Java:1742)
                                                                          at Android.widget.LinearLayout.layoutVertical(LinearLayout.Java:1585)
                                                                          at Android.widget.LinearLayout.onLayout(LinearLayout.Java:1494)
                                                                          at Android.view.View.layout(View.Java:17945)
                                                                          at Android.view.ViewGroup.layout(ViewGroup.Java:5812)
                                                                          at Android.widget.FrameLayout.layoutChildren(FrameLayout.Java:344)
                                                                          at Android.widget.FrameLayout.onLayout(FrameLayout.Java:281)
                                                                          at Android.view.View.layout(View.Java:17945)
                                                                          at Android.view.ViewGroup.layout(ViewGroup.Java:5812)
                                                                          at Android.widget.LinearLayout.setChildFrame(LinearLayout.Java:1742)
                                                                          at Android.widget.LinearLayout.layoutVertical(LinearLayout.Java:1585)
                                                                          at Android.widget.LinearLayout.onLayout(LinearLayout.Java:1494)
                                                                          at Android.view.View.layout(View.Java:17945)
                                                                          at Android.view.ViewGroup.layout(ViewGroup.Java:5812)
                                                                          at Android.widget.FrameLayout.layoutChildren(FrameLayout.Java:344)
                                                                          at Android.widget.FrameLayout.onLayout(FrameLayout.Java:281)
                                                                          at com.Android.internal.policy.PhoneWindow$DecorView.onLayout(PhoneWindow.Java:3178)
                                                                          at Android.view.View.layout(View.Java:17945)
                                                                          at Android.view.ViewGroup.layout(ViewGroup.Java:5812)
                                                                          at Android.view.ViewRootImpl.performLayout(ViewRootImpl.Java:2716)
                                                                          at Android.view.ViewRootImpl.performTraversals(ViewRootImpl.Java:2417)
                                                                          at Android.view.ViewRootImpl.doTraversal(ViewRootImpl.Java:1487)
                                                                          at Android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.Java:7450)
                                                                          at Android.view.Choreographer$CallbackRecord.run(Choreographer.Java:920)
                                                                          at Android.view.Choreographer.doCallbacks(Choreographer.Java:695)
                                                                          at Android.view.Choreographer.doFrame(Choreographer.Java:631)
                                                                        at Android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographe
13
user5076870

Решено следующим ответом на этот вопрос: Поддержка Android Repo 46.0.0 с Android Studio 2.3

Решение:

Добавлен этот скрипт в файл build.gradle в конце app.module

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

Надеюсь, что это поможет другим людям.

34
user5076870

Попробуйте это, это решит ошибку

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'
            }
        }
    }
}
0
Smit Patel