Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AnimatorCompatHelper Class Not Found Exception using AppCompat 26.0.0 #396

Closed
jordyamc opened this issue Jun 13, 2017 · 35 comments

Comments

@jordyamc
Copy link

commented Jun 13, 2017

When using compat library 26.0.0 the app crash when doing Recyclerview Animations

java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v4/animation/AnimatorCompatHelper;
     at com.h6ah4i.android.widget.advrecyclerview.animator.impl.BaseItemAnimationManager.resetAnimation(BaseItemAnimationManager.java:161)
     at com.h6ah4i.android.widget.advrecyclerview.animator.RefactoredDefaultItemAnimator$DefaultItemMoveAnimationManager.addPendingAnimation(RefactoredDefaultItemAnimator.java:312)
     at com.h6ah4i.android.widget.advrecyclerview.animator.GeneralItemAnimator.animateMove(GeneralItemAnimator.java:88)
     at android.support.v7.widget.SimpleItemAnimator.animatePersistence(SimpleItemAnimator.java:140)
     at android.support.v7.widget.RecyclerView$4.processPersistent(RecyclerView.java:543)
     at android.support.v7.widget.ViewInfoStore.process(ViewInfoStore.java:239)
     at android.support.v7.widget.RecyclerView.dispatchLayoutStep3(RecyclerView.java:3761)
     at android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.java:3419)
     at android.support.v7.widget.RecyclerView.onLayout(RecyclerView.java:3960)
@h6ah4i

This comment has been minimized.

Copy link
Owner

commented Jun 14, 2017

Hi, thanks for the report. I guess there are a lot of more incompatibilities exist because the support library v26 has changed its min SDK to API level 14. Also, I am going to change the min SDK level of this library when after non-beta version of support library v26 is released.

@h6ah4i h6ah4i added this to the support library 26.0.0 milestone Jun 14, 2017

@jordyamc

This comment has been minimized.

Copy link
Author

commented Jun 15, 2017

I made a pull request with a temporally fix using appcompat 25.3.1

@jordyamc

This comment has been minimized.

Copy link
Author

commented Jun 15, 2017

Also i use Appcompat 26.0.0-beta2 in my app and i have no problems with Drag/Drop, Swipe, and Expand/Collapse using my fix :D

@arkon

This comment has been minimized.

Copy link

commented Jul 25, 2017

I'm seeing this issue with the stable release of AppCompat 26.0.0 too.

@guidedways

This comment has been minimized.

Copy link

commented Jul 25, 2017

Would be good to have this fix out please

@iUmarov

This comment has been minimized.

Copy link

commented Jul 26, 2017

I have got the same crash with stable release of Support Library 26.0.0

@h6ah4i h6ah4i added the enhancement label Jul 26, 2017

@h6ah4i h6ah4i self-assigned this Jul 26, 2017

@h6ah4i

This comment has been minimized.

Copy link
Owner

commented Jul 26, 2017

Hi, guys. Sorry for the inconvenience 🙇

I am going to start working for the new support libraries v26.0.0. Hopefully, I can manage all features work well with the new libraries soon...

@h6ah4i

This comment has been minimized.

Copy link
Owner

commented Aug 1, 2017

I've just pushed a new branch which bumps support libraries to v26. I am now working on this branch and its still a pre-stable version.


If you want to try it out now, please add the following jitpack configuration to build.gradle.

repositories {
    maven { url "https://jitpack.io" }
}
dependencies {
    compile 'com.github.h6ah4i:android-advancedrecyclerview:feature~support_libraries_v26-SNAPSHOT'
}
@huteri

This comment has been minimized.

Copy link

commented Aug 9, 2017

@h6ah4i tried it, and still crashing

FATAL EXCEPTION: main
Process: com.huteri.monas, PID: 13689
java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v4/animation/AnimatorCompatHelper;
    at com.h6ah4i.android.widget.advrecyclerview.animator.impl.BaseItemAnimationManager.resetAnimation(BaseItemAnimationManager.java:161)
    at com.h6ah4i.android.widget.advrecyclerview.animator.RefactoredDefaultItemAnimator$DefaultItemChangeAnimationManager.addPendingAnimation(RefactoredDefaultItemAnimator.java:220)
    at com.h6ah4i.android.widget.advrecyclerview.animator.GeneralItemAnimator.animateChange(GeneralItemAnimator.java:111)
    at android.support.v7.widget.SimpleItemAnimator.animateChange(SimpleItemAnimator.java:163)
    at android.support.v7.widget.RecyclerView.animateChange(RecyclerView.java:3954)
    at android.support.v7.widget.RecyclerView.dispatchLayoutStep3(RecyclerView.java:3753)
    at android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.java:3421)
    at android.support.v7.widget.RecyclerView.onLayout(RecyclerView.java:3962)
    at android.view.View.layout(View.java:17523)
    at android.view.ViewGroup.layout(ViewGroup.java:5612)
    at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1079)
    at android.view.View.layout(View.java:17523)
    at android.view.ViewGroup.layout(ViewGroup.java:5612)
    at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323)
    at android.widget.FrameLayout.onLayout(FrameLayout.java:261)
    at android.view.View.layout(View.java:17523)
    at android.view.ViewGroup.layout(ViewGroup.java:5612)
    at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323)
    at android.widget.FrameLayout.onLayout(FrameLayout.java:261)
    at android.view.View.layout(View.java:17523)
    at android.view.ViewGroup.layout(ViewGroup.java:5612)
    at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1741)
    at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1585)
    at android.widget.LinearLayout.onLayout(LinearLayout.java:1494)
    at android.view.View.layout(View.java:17523)
    at android.view.ViewGroup.layout(ViewGroup.java:5612)
    at android.support.v4.widget.DrawerLayout.onLayout(DrawerLayout.java:1172)
    at android.view.View.layout(View.java:17523)
    at android.view.ViewGroup.layout(ViewGroup.java:5612)
    at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323)
    at android.widget.FrameLayout.onLayout(FrameLayout.java:261)
    at android.view.View.layout(View.java:17523)
    at android.view.ViewGroup.layout(ViewGroup.java:5612)
    at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323)
    at android.widget.FrameLayout.onLayout(FrameLayout.java:261)
    at android.view.View.layout(View.java:17523)
    at android.view.ViewGroup.layout(ViewGroup.java:5612)
    at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323)
    at android.widget.FrameLayout.onLayout(FrameLayout.java:261)
    at android.view.View.layout(View.java:17523)
    at android.view.ViewGroup.layout(ViewGroup.java:5612)
    at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323)
    at android.widget.FrameLayout.onLayout(FrameLayout.java:261)
    at android.view.View.layout(View.java:17523)
    at android.view.ViewGroup.layout(ViewGroup.java:5612)
    at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323)
    at android.widget.FrameLayout.onLayout(FrameLayout.java:261)
    at com.android.internal.policy.DecorView.onLayout(DecorView.java:724)
    at android.view.View.layout(View.java:17523)
    at android.view.ViewGroup.layout(ViewGroup.java:5612)
    at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2342)
    at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2069)
    at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1246)
    at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6301)
    at android.view.Choreographer$CallbackRecord.run(Choreographer.java:871)
    at android.view.Choreographer.doCallbacks(Choreographer.java:683)
    at android.view.Choreographer.doFrame(Choreographer.java:619)
    at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:857)
    at android.os.Handler.handleCallback(Handler.java:751)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:154)
    at android.app.ActivityThread.main(ActivityThread.java:6077)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756)
 Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.v4.animation.AnimatorCompatHelper" on path: DexPathList[[zip file "/data/app/com.huteri.monas-1/base.apk", zip file "/data/app/com.huteri.monas-1/split_lib_dependencies_apk.apk", zip file "/data/app/com.huteri.monas-1/split_lib_slice_0_apk.apk", zip file "/data/app/com.huteri.monas-1/split_lib_slice_1_apk.apk", zip file "/data/app/com.huteri.monas-1/split_lib_slice_2_apk.apk", zip file "/data/app/com.huteri.monas-1/split_lib_slice_3_apk.apk", zip file "/data/app/com.huteri.monas-1/split_lib_slice_4_apk.apk", zip file "/data/app/com.huteri.monas-1/split_lib_slice_5_apk.apk", zip file "/data/app/com.huteri.monas-1/split_lib_slice_6_apk.apk", zip file "/data/app/com.huteri.monas-1/split_lib_slice_7_apk.apk", zip file "/data/app/com.huteri.monas-1/split_lib_slice_8_apk.apk", zip file "/data/app/com.huteri.monas-1/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.huteri.monas-1/lib/x86, /system/lib, /vendor/lib]]
    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
    	... 65 more

and yes, I have cleaned and reinstalled,
screen shot 2017-08-09 at 1 27 48 pm

EDIT

Solved with

compile 'com.github.h6ah4i:android-advancedrecyclerview:feature~support_libraries_v26-SNAPSHOT'
@h6ah4i

This comment has been minimized.

Copy link
Owner

commented Aug 9, 2017

@huteri Thanks for your clarification. I forgot to change the commit ID 😓

@guidedways

This comment has been minimized.

Copy link

commented Aug 22, 2017

Any updates on this? Android O just got officially released by the way yesterday, which means we're still waiting for an official fix on the main branch.

KirillMakarov added a commit to StepicOrg/stepik-android that referenced this issue Aug 22, 2017

@Devofure

This comment has been minimized.

Copy link

commented Sep 2, 2017

Please, give us more information about when this library will be updated, Thank you.

@iUmarov

This comment has been minimized.

Copy link

commented Sep 6, 2017

I am about to publish my app in which I used this library. So, I would like to know whether I should wait for its stable release or pre-stable version (feature~support_libraries_v26-SNAPSHOT) is also fine.

@Twinsen81

This comment has been minimized.

Copy link

commented Sep 13, 2017

This solution worked for me:
https://stackoverflow.com/questions/43320496/noclassdeffounderror-android-support-v4-animation-animatorcompathelper

Added to the bottom of the build.gradle (Module:app):

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

@h6ah4i h6ah4i modified the milestones: appcompat 26.0.0, next release Sep 18, 2017

@SUKI-Huang

This comment has been minimized.

Copy link

commented Sep 19, 2017

compile 'com.github.h6ah4i:android-advancedrecyclerview:feature~support_libraries_v26-SNAPSHOT'

does not available now ?
I got an error this morning

Error:Could not find com.github.h6ah4i:android-advancedrecyclerview:feature~support_libraries_v26-SNAPSHOT.
Required by:
    project :TEST
    Search in build.gradle files
@FredDev06

This comment has been minimized.

Copy link

commented Sep 19, 2017

Same here! The snapshot version with support library 26 does not seem to be available anymore.
:/

@olidroide

This comment has been minimized.

Copy link

commented Sep 19, 2017

@FredDev06 @SUKI-Huang I'm using develop branch as workaround:

compile 'com.github.h6ah4i:android-advancedrecyclerview:develop-SNAPSHOT'

@fmeneuhe

This comment has been minimized.

Copy link

commented Sep 25, 2017

Has this issue of NoClassDefFoundError been fixed?

@fdonzello

This comment has been minimized.

Copy link

commented Oct 6, 2017

nope.. still there in develop-SNAPSHOT

@AXwjg

This comment has been minimized.

Copy link

commented Oct 18, 2017

The solution is to add the following code block to your 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 '24.1.0'
}
}
}
}

@devjta

This comment has been minimized.

Copy link

commented Oct 23, 2017

wrong project ;-)

@tdtran

This comment has been minimized.

Copy link

commented Oct 23, 2017

FWIW I use the snapshot version in production and it works perfectly well for users of my apps

@devjta

This comment has been minimized.

Copy link

commented Oct 23, 2017

Yeah, was barking at the wrong tree :D Found the error/cultrip for it..

But if you have to wait for external programs + HAVE to use the Android 8.0/Oreo SDK, just create the class with the HoneyCombImplementation:

Create class: android.support.v4.animation.AnimatorCompatHelper

public class AnimatorCompatHelper {
private static TimeInterpolator mDefaultInterpolator;
public static void clearInterpolator(View view){
if(view != null){
if (mDefaultInterpolator == null) {
mDefaultInterpolator = new ValueAnimator().getInterpolator();
}
view.animate().setInterpolator(mDefaultInterpolator);
}
}
}

@svenoaks

This comment has been minimized.

Copy link

commented Oct 25, 2017

Creating the AnimatorCompatHelper class seems to work but not sure if totally safe. compile 'com.github.h6ah4i:android-advancedrecyclerview:develop-SNAPSHOT' has weird animation when item is dragged to new position that wasn't present in older.

@SUKI-Huang

This comment has been minimized.

Copy link

commented Oct 25, 2017

I got same issue with @svenoaks

@devjta

This comment has been minimized.

Copy link

commented Oct 25, 2017

Well all I did was looking at the sources of AnimatorCompatHelper and replaced its behavior. Original code:
https://android.googlesource.com/platform/frameworks/support/+/e1e957f/v4/java/android/support/v4/animation/AnimatorCompatHelper.java
And the impl of the animator:
https://github.com/phhusson/SafetyNet/blob/master/android/support/v4/animation/HoneycombMr1AnimatorCompatProvider.java

h6ah4i replaced it the same way I did it..

I used that trick in that project: muditsen/multilevelrecyclerview#5 and the recyclerview works fine. But if you have problems, maybe the problem could also be there.. So it would be really nice to know, how it was changed in the snapshot.

@devjta

This comment has been minimized.

Copy link

commented Oct 25, 2017

If you create the AnimatorCompatHelper class, you dont need the develop-branch!! The devleop-branch got rid of the class and instead uses this here (decompiled from the develop-lib)

protected void resetAnimation(RecyclerView.ViewHolder holder) {
    if (sDefaultInterpolator == null) {
        sDefaultInterpolator = new ValueAnimator().getInterpolator();
    }
    holder.itemView.animate().setInterpolator(sDefaultInterpolator);
    endAnimation(holder);
}

VS
https://github.com/h6ah4i/android-advancedrecyclerview/blob/master/library/src/main/java/com/h6ah4i/android/widget/advrecyclerview/animator/impl/BaseItemAnimationManager.java

Which is kinda the same, you will see in the HoneycombMr1AnimatorCompatProvider.java or at my post 2 days ago.

So again with the develop version, you dont need to create the CompatHelper class. You can use the stable version and add the CompatHelper class.

But both things uses the same methods.. So if the animations are not working, I cannot help you at all.. Just try the NOT-develop version/Stable version with the AnimatorCompatHelper and see if it works..

@svenoaks

This comment has been minimized.

Copy link

commented Oct 25, 2017

@devjta thanks for your help I don't have problems with your class and I am using the stable branch, I'm just worried that there might be other incompatibilities with library 26 besides this obvious one if it is used in production.

@devjta

This comment has been minimized.

Copy link

commented Oct 25, 2017

I am developing for a week with the 26sdk + support (v4 and v7) now and everything looks quite good.

There were some changes for Notifiation-stuff (you need a channel now) and background-services are limited now. But these change just happens on Android 8 devices..

@h6ah4i

This comment has been minimized.

Copy link
Owner

commented Oct 29, 2017

@svenoaks, @devjta, @SUKI-Huang, @tdtran, @AXwjg, @fdonzello

Hi all, sorry for the very late response 🙇

I have just released v0.11.0 today and it includes the fix of this issue, so I am going to close this issue within a few days.


Creating the AnimatorCompatHelper class seems to work but not sure if totally safe. compile 'com.github.h6ah4i:android-advancedrecyclerview:develop-SNAPSHOT' has weird animation when item is dragged to new position that wasn't present in older.
#425

I am afraid that this might be a regression of the latest release.

I hope this issue would be solved by implementing the new onItemDragStarted() / onItemDragFinished() methods. Please read the following migration guide for more detials. (If you still see the issue with v0.11.0 , please create a new issue report.) Thanks.

@guidedways

This comment has been minimized.

Copy link

commented Oct 29, 2017

He's alive!!! Thanks man.

@h6ah4i h6ah4i closed this Nov 6, 2017

@98ki

This comment has been minimized.

Copy link

commented Dec 19, 2017

the solutation all use old version , @h6ah4i how u fix the problem without AnimatorCompatHelper? I can`t find where I use it , select none result in my project , so can u tell me how to find where I use it then fix it.

@ajit-sharma

This comment has been minimized.

Copy link

commented Dec 29, 2017

Even after shifting to 25.3.1 it causing a crash.
No previously mentioned tricks working.
Please help.

@devjta

This comment has been minimized.

Copy link

commented Dec 29, 2017

The solution many use, is what I posted at 25th October.. Just create the class and implement the method like it was in Android sdk.
Or the project-owner remove any use of the AnimatorCompatHelper (also includes, etc.) and uses his own animation or copy the impl from Android.

@swapnilbhai90

This comment has been minimized.

Copy link

commented Mar 20, 2018

I am using buildtoolVersion 26.0.2 and targetSdkVersion 26.0.2 .
Using library Expandablelayout which is using AnimatorCompatHelper.
I crashing saying java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v4/animation/AnimatorCompatHelper;

Please help me out with this...can't remove this lib

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
You can’t perform that action at this time.