Issue 1:
Glide Version: 4.2.0

Integration libraries: OkHttp3

Device/Android Version: SM-G5510;Android 6.0.1,level 23

Wrap Code:

public void onlyLoadAsGifBitmap(Context context, final View imageView, final String url, int width, int height, final int placeHoldId){
if(isActivityDestroy(context)){
return;
}
GlideApp.with(context).asGif().load(url).override(width, height).into(new SimpleTarget<GifDrawable>() {
@Override
public void onResourceReady(GifDrawable resource, Transition<? super GifDrawable> transition) {
if(resource==null){
imageView.setBackgroundResource(placeHoldId);
return;
}
if(imageView instanceof ImageView){
((ImageView) imageView).setImageDrawable(resource);
}else {
imageView.setBackground(resource);
}
}
@Override
public void onLoadFailed( Drawable errorDrawable) {
imageView.setBackgroundResource(placeHoldId);
}
});
}

Called Code:

onlyLoadAsGifBitmap(LauncherUI.this, tiaImageView, imageUrl, UITools.getWidth(), UITools.getHeight(), R.drawable.flash);

Crash Report:

java.lang.NullPointerException: Attempt to invoke virtual method 'int android.graphics.Bitmap.getWidth()' on a null object reference com.bumptech.glide.load.resource.gif.GifFrameLoader.int getWidth()(SourceFile:126) com.bumptech.glide.load.resource.gif.GifDrawable.int getIntrinsicWidth()(SourceFile:215) android.widget.ImageView.invalidateDrawable(ImageView.java:243) android.graphics.drawable.Drawable.invalidateSelf(Drawable.java:844) android.graphics.drawable.Drawable.setVisible(Drawable.java:1575) com.bumptech.glide.load.resource.gif.GifDrawable.boolean setVisible(boolean,boolean)(SourceFile:210) android.widget.ImageView.onDetachedFromWindow(ImageView.java:1511) android.view.View.dispatchDetachedFromWindow(View.java:15916) android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:3377) android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:3377) android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:3377) android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:3377) android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:3377) android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:3377) android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:3377) android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:3377) android.view.ViewRootImpl.dispatchDetachedFromWindow(ViewRootImpl.java:3838) android.view.ViewRootImpl.doDie(ViewRootImpl.java:7087) android.view.ViewRootImpl.die(ViewRootImpl.java:7060) android.view.WindowManagerGlobal.removeViewLocked(WindowManagerGlobal.java:424) android.view.WindowManagerGlobal.removeView(WindowManagerGlobal.java:379) android.view.WindowManagerImpl.removeViewImmediate(WindowManagerImpl.java:140) android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:5190) android.app.ActivityThread.access$1700(ActivityThread.java:229) android.app.ActivityThread$H.handleMessage(ActivityThread.java:1880) android.os.Handler.dispatchMessage(Handler.java:102) android.os.Looper.loop(Looper.java:148) android.app.ActivityThread.main(ActivityThread.java:7410) java.lang.reflect.Method.invoke(Native Method) com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230) com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)

now the crash occurs less,only affecting two users.when readed #2282 and #2231 ,i find not same like those,i only load gifDrawable for the view,instead of using cross-fade animation. i read this answer and souce code related to gifDrawable ,but i still do'nt kown detail reason..

Issue 2:
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'int android.graphics.Bitmap.getWidth()' on a null object reference
at com.bumptech.glide.load.resource.gif.GifFrameLoader.getWidth(GifFrameLoader.java:127)
at com.bumptech.glide.load.resource.gif.GifDrawable.getIntrinsicWidth(GifDrawable.java:215)
at android.widget.ImageView.invalidateDrawable(ImageView.java:232)
at android.graphics.drawable.Drawable.invalidateSelf(Drawable.java:385)
at android.graphics.drawable.Drawable.setVisible(Drawable.java:764)
at com.bumptech.glide.load.resource.gif.GifDrawable.setVisible(GifDrawable.java:210)
at android.widget.ImageView.onDetachedFromWindow(ImageView.java:1485)
at android.view.View.dispatchDetachedFromWindow(View.java:14555)
at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:3063)
at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:3063)
at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:3063)
at android.view.ViewGroup.removeViewInternal(ViewGroup.java:4603)
at android.view.ViewGroup.removeViewInternal(ViewGroup.java:4576)
at android.view.ViewGroup.removeView(ViewGroup.java:4507)
at android.support.v4.view.ViewPager.removeView(ViewPager.java:1499)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1520)
at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1740)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1809)
at android.support.v4.app.FragmentManagerImpl.dispatchStateChange(FragmentManager.java:3217)
at android.support.v4.app.FragmentManagerImpl.dispatchDestroy(FragmentManager.java:3208)
at android.support.v4.app.FragmentController.dispatchDestroy(FragmentController.java:262)
at android.support.v4.app.FragmentActivity.onDestroy(FragmentActivity.java:350)
at android.support.v7.app.AppCompatActivity.onDestroy(AppCompatActivity.java:209)
at org.thoughtcrime.securesms.PassphraseRequiredActionBarActivity.onDestroy(PassphraseRequiredActionBarActivity.java:83)
at android.app.Activity.performDestroy(Activity.java:6407)
at android.app.Instrumentation.callActivityOnDestroy(Instrumentation.java:1142)
at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:3818)

I'm using Glide 4.3.0 to load GIFs into a RecyclerView. Some users are reporting that if they scroll quickly and then close the activity, they get a crash.

Glide Version: 4.3.0