I am seeing the following error in my Android crash reports:
android.os.BadParcelableException: ClassNotFoundException when unmarshalling: android.support.v4
If you don't want to include the source in v4 package you can declare the "fix" directly in your Adapter
@Override
public Object instantiateItem(ViewGroup container, int position) {
final Object fragment = super.instantiateItem(container, position);
try {
final Field saveFragmentStateField = Fragment.class.getDeclaredField("mSavedFragmentState");
saveFragmentStateField.setAccessible(true);
final Bundle savedFragmentState = (Bundle) saveFragmentStateField.get(fragment);
if (savedFragmentState != null) {
savedFragmentState.setClassLoader(Fragment.class.getClassLoader());
}
} catch (Exception e) {
Log.w("CustomFragmentStatePagerAdapter", "Could not get mSavedFragmentState field", e);
}
return fragment;
}