-
Notifications
You must be signed in to change notification settings - Fork 6.1k
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
NoSuchMethodError being thrown in Glide.get() in Application onCreate #578
Comments
For completeness, here is how ActivityManagerCompat from support library works: public static boolean isLowRamDevice(@NonNull ActivityManager am) {
if (Build.VERSION.SDK_INT >= 19) {
return ActivityManagerCompatKitKat.isLowRamDevice(am);
}
return false;
}
class ActivityManagerCompatKitKat {
public static boolean isLowRamDevice(ActivityManager am) {
return am.isLowRamDevice();
}
} vs how Glide does it: @TargetApi(Build.VERSION_CODES.KITKAT)
private static boolean isLowMemoryDevice(ActivityManager activityManager) {
final int sdkInt = Build.VERSION.SDK_INT;
return sdkInt < Build.VERSION_CODES.HONEYCOMB
|| (sdkInt >= Build.VERSION_CODES.KITKAT && activityManager.isLowRamDevice());
} |
Thanks for the report, it makes me scratch my head: reading the code makes nothing pop out. I have two theories about Android JVMs (and maybe desktop ones too):
The problem is that these are both just theories, I don't have any evidence pro or contra. Hopefully @sjudd will have some insight, but it may worth asking a SO question, hopefully some Android JVM expert picks it up (just make sure you tag it correctly with android/jvm/dalvik/art). |
Huh yeah I don't have any insight here, but it's pretty easy to change if @TWiStErRob's second theory is correct. I can try and push up a change and maybe @joshzana you can try the snapshot? |
Sure. I'll give it a shot. I don't have a repro though, so it will have to wait for our next release to get enough coverage and see if the fix takes |
You know that it's weird, and probably trumps both of my theories, that you get the crashes on the systems where this method must exist, and not on old ones. |
What is your min/target SDK? |
15/21. Compile SDK 22. This is for Dropbox Android, so we have a pretty huge sample size. |
I would check in the crash report that the value of Build.VERSION.SDK_INT is correct. |
Out of curiosity did you ever figure out a work around for this? |
I get this bug too, I found this bug occurred because of some custom rom modify the "Api Level", for example "Android 4.3,level 19". |
Our app analytics are showing a few hundred of these crashes across a few dozen devices:
The devices crashing range from Android 4.4.0 to 5.1.1, and come from Samsung, HTC, and other OEMs.
My code inspection of MemorySizeCalculator makes me think this should be working fine, and I don't understand why the only crashes are in levels where this method should be present. Maybe bad OEM customizations?
Any ideas?
The text was updated successfully, but these errors were encountered: