Falling encoding of fake Android packages

I have a problem in android app, app crashing from main activity and error message

Caused by: java.lang.RuntimeException: bogus span encoding 17831
    at android.text.TextUtils$1.createFromParcel(TextUtils.java:802)...


this does not happen on all devices, as I can reproduce the bug that often occurs in 5.1 and 5.1 versions for Android 5.0, and also in 5.1.1 for Samsung version 5.1.1 the bug exists.

I've researched a lot but haven't decided. It seems it was a problem with android 4.0 version. *, But has been fixed in recent Android versions.

Can anyone help find the problem?


Extended error message:

Caused by: java.lang.RuntimeException: bogus span encoding 17831
    at android.text.TextUtils$1.createFromParcel(TextUtils.java:802)
    at android.text.TextUtils$1.createFromParcel(TextUtils.java:679)
    at android.os.Parcel.readCharSequence(Parcel.java:1606)
    at android.os.Parcel.readCharSequenceArray(Parcel.java:1823)
    at android.os.Parcel.readValue(Parcel.java:2185)
    at android.os.Parcel.readArrayMapInternal(Parcel.java:2485)
    at android.os.BaseBundle.unparcel(BaseBundle.java:221)
    at android.os.Bundle.getParcelable(Bundle.java:755)
    at android.app.Activity.onCreate(Activity.java:932)
    at android.support.v4.app.FragmentActivity.onCreate(FragmentActivity.java:255)



source to share

3 answers

You probably have a character that is not recognized in your application.

If you check the Android source code, http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/2.0_r1/android/text/TextUtils.java

The exception is thrown on line 715 of the method public CharSequence createFromParcel(Parcel p) {


Check the gaps in your program to see if there is a problem.



Yes, I managed to figure out this problem. I have a model in my application whose fields are filled from a json response, and my model implements serializable and serial interfaces. I have annotated my model fields with the SerializedName ("json_field_name") method.

Except for the json fields, I have included other fields in my model. And at some point when I retrieved data from json using gson library and didn't get data for custom fields that I specified in the model (not json fields) I got this error.

For me the problem was fixed by removing objects from the model that are not in the json.



I was getting the same error too. I missed the variable in the arbitrary constructor.

You have to add all your variables to the constructor of the pogo class, which is simple.

 protected your_class_name(Parcel in) {
    var1= in.readString();
    var2= in.readString();
    var3= in.readString();



Hope it helps.



All Articles