Issue 1:
Error info

.......

Caused by: java.lang.IllegalArgumentException: regist too many Broadcast Receivers

at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:1838)

at android.app.ContextImpl.registerReceiver(ContextImpl.java:1794)

at android.app.ContextImpl.registerReceiver(ContextImpl.java:1788)

at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:489)

at com.bumptech.glide.manager.DefaultConnectivityMonitor.register(DefaultConnectivityMonitor.java:60)

at com.bumptech.glide.manager.DefaultConnectivityMonitor.onStart(DefaultConnectivityMonitor.java:106)

at com.bumptech.glide.manager.ActivityFragmentLifecycle.onStart(ActivityFragmentLifecycle.java:51)

............

IllegalArgumentException.java

class IllegalArgumentException extends RuntimeException {
..........
}

Glide version :4.12.0

DefaultConnectivityMonitor.java
........
private void register() {
if (isRegistered) {
return;
}

// Initialize isConnected.
isConnected = isConnected(context);
try {
// See #1405
context.registerReceiver(
connectivityReceiver, new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION));
isRegistered = true;
} catch (SecurityException e) {
// See #1417, registering the receiver can throw SecurityException.
if (Log.isLoggable(TAG, Log.WARN)) {
Log.w(TAG, "Failed to register", e);
}
}
}
.......

SecurityException.java

public class SecurityException extends RuntimeException {
......
}

you can change code like this

try {
// See #1405
context.registerReceiver(
connectivityReceiver, new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION));
isRegistered = true;
} catch (RuntimeException e) {
// See #1417, registering the receiver can throw SecurityException.
if (Log.isLoggable(TAG, Log.WARN)) {
Log.w(TAG, "Failed to register", e);
}
}

or

try {
// See #1405
context.registerReceiver(
connectivityReceiver, new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION));
isRegistered = true;
} catch (SecurityException e) {
........
} catch (IllegalArgumentException e) {
............
}

Issue 2:
Glide Version: compile 'com.github.bumptech.glide:glide:3.7.0'

Integration libraries: NA

Device/Android Version: Samsung A5 with 2 GB Rams

Issue details / Repro steps / Use case background: I am trying to load album art in view pager with the help of glide

Glide load line / GlideModule (if any) / list Adapter code (if any):

**
* The Class SongPagerAdapter.
*/
public class SongPagerAdapter extends PagerAdapter {
private Context mContext;
private LayoutInflater mLayoutInflater;

public SongPagerAdapter(Context context) {
mContext = context;
mLayoutInflater = (LayoutInflater) mContext
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

}

@Override
public int getCount() {
return CenterRepository.getInstance().getAudioCollection().getListOfSongs().size();
}

@Override
public boolean isViewFromObject(View view, Object object) {
return view == ((FrameLayout) object);
}

@Override
public Object instantiateItem(ViewGroup container, final int position) {
final View itemView = mLayoutInflater.inflate(R.layout.view_media_page, container,
false);

((TextView) itemView
.findViewById(R.id.songName)).setText(CenterRepository.getInstance().getAudioCollection().getSongAt(position).getTitle());

((TextView) itemView
.findViewById(R.id.albumName)).setText(CenterRepository.getInstance().getAudioCollection().getSongAt(position).getAlbum());

Glide.with(mContext).load(ContentUris.withAppendedId(Uri
.parse("content://media/external/audio/albumart"),
CenterRepository.getInstance().getAudioCollection().getSongAt(position).getAlbumId()))
.placeholder(R.drawable.test_image)
.error(Utils.generatePlaceHolder(CenterRepository.getInstance().getAudioCollection().getSongAt(position).getTitle()))
.centerCrop()
.diskCacheStrategy(DiskCacheStrategy.ALL)
.crossFade()
.into(((ImageView) itemView
.findViewById(R.id.album_art_pager)));

container.addView(itemView);

return itemView;
}

@Override
public void destroyItem(ViewGroup container, int position, Object object) {
container.removeView((FrameLayout) object);
object = null;
}
}

Layout XML:

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"

android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<ImageView
android:id="@+id/album_art_pager"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/album_back"
android:scaleType="fitXY"
android:transitionName="profile" />

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="top"
android:orientation="vertical">

<TextView
android:id="@+id/songName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:background="#99000000"
android:padding="3dp"
android:textColor="#FFF"
android:textSize="25sp" />

<TextView
android:id="@+id/albumName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:background="#99000000"
android:padding="3dp"
android:textColor="#FFF"
android:textSize="20sp" />

<TextView
android:id="@+id/artistName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:background="#99000000"
android:padding="3dp"
android:textColor="#FFF"
android:textSize="20sp" />

</LinearLayout>

</FrameLayout>

Stack trace / LogCat:

09-28 06:58:10.521 3025-3067/? E/WindowManager: Unknown window type: 2200
09-28 06:58:10.931 25530-25530/com.hiteshsahu.piedpiper E/art: Throwing OutOfMemoryError "Failed to allocate a 23040012 byte allocation with 16777120 free bytes and 16MB until OOM"
09-28 06:58:11.021 25530-25530/com.hiteshsahu.piedpiper E/art: Throwing OutOfMemoryError "Failed to allocate a 23040012 byte allocation with 16777120 free bytes and 16MB until OOM"
09-28 06:58:11.021 25530-25530/com.hiteshsahu.piedpiper E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.hiteshsahu.piedpiper, PID: 25530
java.lang.OutOfMemoryError: Failed to allocate a 23040012 byte allocation with 16777120 free bytes and 16MB until OOM
at dalvik.system.VMRuntime.newNonMovableArray(Native Method)
at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:837)
at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:656)
at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:1037)
at android.content.res.Resources.loadDrawableForCookie(Resources.java:4037)
at android.content.res.Resources.loadDrawable(Resources.java:3910)
at android.content.res.TypedArray.getDrawable(TypedArray.java:776)
at android.view.View.<init>(View.java:4001)
at android.widget.ImageView.<init>(ImageView.java:144)
at android.widget.ImageView.<init>(ImageView.java:140)
at android.support.v7.widget.AppCompatImageView.<init>(AppCompatImageView.java:57)
at android.support.v7.widget.AppCompatImageView.<init>(AppCompatImageView.java:53)
at android.support.v7.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:106)
at android.support.v7.app.AppCompatDelegateImplV9.createView(AppCompatDelegateImplV9.java:1013)
at android.support.v7.app.AppCompatDelegateImplV9.onCreateView(AppCompatDelegateImplV9.java:1072)
at android.support.v4.view.LayoutInflaterCompatHC$FactoryWrapperHC.onCreateView(LayoutInflaterCompatHC.java:44)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:732)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:813)
at android.view.LayoutInflater.inflate(LayoutInflater.java:511)
at android.view.LayoutInflater.inflate(LayoutInflater.java:415)
at com.c2h5oh.beer.view.adapter.SongPagerAdapter.instantiateItem(SongPagerAdapter.java:46)
at android.support.v4.view.ViewPager.addNewItem(ViewPager.java:1006)
at android.support.v4.view.ViewPager.populate(ViewPager.java:1154)
at android.support.v4.view.ViewPager.populate(ViewPager.java:1088)
at android.support.v4.view.ViewPager.setAdapter(ViewPager.java:542)
at com.c2h5oh.beer.view.activity.AudioPlayerActivity.addViewListeners(AudioPlayerActivity.java:331)
at com.c2h5oh.beer.view.activity.AudioPlayerActivity.access$800(AudioPlayerActivity.java:60)
at com.c2h5oh.beer.view.activity.AudioPlayerActivity$14.onSuccess(AudioPlayerActivity.java:560)
at com.c2h5oh.beer.domain.OfflineMediaProvider.MediaHost.onPostExecute(MediaHost.java:64)
at com.c2h5oh.beer.domain.OfflineMediaProvider.MediaHost.onPostExecute(MediaHost.java:10)
at android.os.AsyncTask.finish(AsyncTask.java:636)
at android.os.AsyncTask.access$500(AsyncTask.java:177)
at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:653)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:6917)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)
09-28 06:58:11.031 3025-3067/? E/WindowState: getStack: Window{28aeacb2 u0 d0 com.android.settings/com.android.settings