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

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

Closed
ashwanibhatt902 opened this issue Jul 6, 2019 · 12 comments

Comments

@ashwanibhatt902
Copy link

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

@zung
Copy link

zung commented Jul 17, 2019

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

@ashwanibhatt902
Copy link
Author

No, not yet.

@ashwanibhatt902
Copy link
Author

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

@zung
Copy link

zung commented Jul 17, 2019

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

@njdwklopper
Copy link

njdwklopper commented Jul 18, 2019

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

@tangjingyuan
Copy link

See the code snippet:

private static int getImageViewFieldValue(Object object, String fieldName) {
int value = 0;
try {
Field field = ImageView.class.getDeclaredField(fieldName);
field.setAccessible(true);
int fieldValue = (Integer) field.get(object);
if (fieldValue > 0 && fieldValue < Integer.MAX_VALUE) {
value = fieldValue;
}
} catch (Exception e) {
L.e(e);
}
return value;

It's printed by line 139. If you don't want to see the log you can call
L.writeLogs(false)

public static void writeLogs(boolean writeLogs) {
L.writeLogs = writeLogs;
}

@imandaliya
Copy link

imandaliya commented Aug 7, 2019

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
Copy link

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

@njdwklopper
Copy link

I moved to using Glide. Thanks

@JasonTheDynamite
Copy link

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

@DanAtApex
Copy link

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

#1348

Here is my fork:

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

@lioriluz
Copy link

lioriluz commented Jul 30, 2020

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
                }
            });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants