Reputation: 3155
I am getting following exception in production environment. It is related with parcelable classes. But it is not showing which class is problematic. Below is detailed log trace:
Fatal Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{in.app/in.app.activity.MainActivity}: java.lang.RuntimeException: Parcel android.os.Parcel@ae3c90f: Unmarshalling unknown type code -15962911 at offset 816
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2957)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3032)
at android.app.ActivityThread.-wrap11(Unknown Source)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1696)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6942)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
It is happening in onStart
of Activity. I am not passing any parcelable object to the activity. It is launcher one.
How can I find which parcelable is there at specifed
Unmarshalling unknown type code -15962911 at offset 816
Also as per Crashlytics, Device status is as follows:
100% Proximity on
3% App in background
It is happening on multiple OS versions.
MainActivity
public class MainActivity extends BaseActivity implements CleanUpDelegate,
OnFilterAppliedListener,
UpdatePhoneNoDialog.UpdatePhoneNoListener, GoogleApiClient.ConnectionCallbacks,
GoogleApiClient.OnConnectionFailedListener, GenericDialogOperationListener,
DAPopupFragment.DAPopupOperationsListener,
OnLoginListener, HomeScreenFragmentV2.showECOOrderPopup, BottomNavigationRVAdapter.BottomNavigationItemClick
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
createBottomNavigation();
}
@Override
protected void onStart() {
super.onStart();
if (mGoogleApiClient != null) {
mGoogleApiClient.connect();
}
}
}
Upvotes: 4
Views: 1820
Reputation: 1730
The error:
Unmarshalling unknown type code XXXXX at offset XXXXX
Happens when you have an object that implements Parcelable
that is malformed.
public static final Parcelable.Creator<MyClass> CREATOR = new Parcelable.Creator<MyClass>(){
@Override
public MyClass createFromParcel(Parcel source){
// The most common issues are in this constructor.
return new MyClass(source);
}
@Override
public MyClass[] newArray(int size){
return new MyClass[size];
}
}
When you Parcelable
object needs to be recreated the return new MyClass(source);
(using the above example) will be called. And this is where the most common issues happen:
Example: you have a variable id
that is from the type long and you are reading it like this id = source.readInt();
Parcelable
. Example: You try to id = source.readInt();
but you forgot to dest.writeInt(id);
Parcelable
extends from another object that is also Parcelable
and you forgot to call super in the read and write methods.Example:
@Override
public void writeToParcel(Parcel dest, int flags) {
// This is missing
super.writeToParcel(dest, flags);
}
This will preserve the special fields of all Parcelable implementations:
-keepclassmembers class * implements android.os.Parcelable {
static ** CREATOR;
}
tl;dr This is pretty difficult to find what is the issue without all the source code. So my suggestion to you is that you check all your Parcelable
objects that you are using in the activities you mention and check if they are well formed.
Upvotes: 0
Reputation: 1842
Since it is happening in production, high probability is it is because of ProGuard obfuscating Parcelable classes.
Try including this in your ProGuard config file:
-keepclassmembers class * implements android.os.Parcelable {
static ** CREATOR;
}
For further info, there is a recommended configuration for Android applications available in the ProGuard Manual, with detailed explanation about entries.
Upvotes: 1