nostra13 / Android-Universal-Image-Loader

Powerful and flexible library for loading, caching and displaying images on Android.
Apache License 2.0
16.78k stars 6.1k forks source link

java.lang.NoSuchFieldException: No field mMaxHeight in class Landroid/widget/ImageView #1343

Closed ashwanibhatt902 closed 4 years ago

ashwanibhatt902 commented 5 years ago

any help resolving this? Screen Shot 2019-07-06 at 7 45 00 PM

zung commented 5 years ago

i have got the same issues. Have you resolved it yet?

ashwanibhatt902 commented 5 years ago

No, not yet.

ashwanibhatt902 commented 5 years ago

But I believe there might be at least 1 fork where this is fixed. I tried finding but could not find one.

zung commented 5 years ago

Ok, thank you. I'll wait for your good news. :)

njdwklopper commented 5 years ago

Anything happening with this ticket? Having same issue all of a sudden.

tangjingyuan commented 5 years ago

See the code snippet: https://github.com/nostra13/Android-Universal-Image-Loader/blob/1af62c41b5d10503732568f0c47628762bbd8eb9/library/src/main/java/com/nostra13/universalimageloader/core/imageaware/ImageViewAware.java#L129-L141

It's printed by line 139. If you don't want to see the log you can call L.writeLogs(false) https://github.com/nostra13/Android-Universal-Image-Loader/blob/1af62c41b5d10503732568f0c47628762bbd8eb9/library/src/main/java/com/nostra13/universalimageloader/utils/L.java#L67-L69

imandaliya commented 5 years ago

Same issue with Android Q only

java.lang.NoSuchFieldException: No field mMaxHeight in class Landroid/widget/ImageView;

Here is android documentation of the Restricted class

Greylist non-SDK interfaces that are now restricted in Android Q

Need to update library according to support Android Q

tangjingyuan commented 5 years ago

I think you can implement your owner ImageAware and define proper width/height for small image or big one.

njdwklopper commented 5 years ago

I moved to using Glide. Thanks

JasonTheDynamite commented 4 years ago

Are there any new informations about this ? I am getting this error and can not move forward with my project because of this...

DanAtApex commented 4 years ago

I created a PR to fix the problem but obviously without the repo being maintained, it may never be merged:

https://github.com/nostra13/Android-Universal-Image-Loader/pull/1348

Here is my fork:

https://github.com/DanAtApex/Android-Universal-Image-Loader

lioriluz commented 4 years ago

This happens because your imageview is still not inflated when you use it. Probably because you have nested fragments (childFragmentManager). Use this to make sure the imageView is ready for use:

IMAGEVIEW.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
                @Override
                public void onGlobalLayout() {
                    IMAGEVIEW.getViewTreeObserver().removeOnGlobalLayoutListener(this););
                    //Load an image to your IMAGEVIEW here
                }
            });