web-dev-qa-db-fra.com

NoClassDefFoundError Android/support/v4/animation/AnimatorCompatHelper

Après la mise à jour d'Android Studio vers la version 2.3.1 et une gradation vers la version 3.3, j'ai constaté que l'application se bloquait lors d'une activité donnée. Avant la mise à jour, tout allait bien. J'ai perdu une journée sur ce sujet et je n'arrive vraiment pas à comprendre pourquoi je reçois A 'Java.lang.NoClassDefFoundError: Echec de la résolution de: Landroid/support/v4/animation/AnimatorCompatHelper ; ' exception fatale.

Je téléchargerai également les parties les plus importantes du fichier 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:1.4.0@aar"
compile 'com.github.crosswall:Android-Coverflow:release-v1.0.4'
compile 'com.dropbox.core:dropbox-core-sdk:2.1.2'
}

Voici la pile d'exceptions complète:

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

Résolu en suivant la réponse à cette question: Android Support Repo 46.0.0 avec Android Studio 2.3

Solution:

Ajout de ce script dans le fichier build.gradle à la fin de 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'
            }
        }
    }
}

J'espère que cela aidera d'autres personnes.

34
user5076870

Essayez ceci cela résoudra l'erreur

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