Robolectric: Flaky tests due to ShadowParcel UnreliableBehaviorError

Created on 17 May 2019  路  3Comments  路  Source: robolectric/robolectric

From b/132768543

Caused by: java.lang.RuntimeException: org.robolectric.shadows.ShadowParcel$UnreliableBehaviorError: Looking for String at position 464, found Long [4693162461005763194] taking 8 bytes, and it is non-portable to reinterpret it
at org.robolectric.shadows.ShadowParcel$ByteBuffer.readValue(ShadowParcel.java:1124)
at org.robolectric.shadows.ShadowParcel$ByteBuffer.readString(ShadowParcel.java:816)
at org.robolectric.shadows.ShadowParcel.nativeReadString(ShadowParcel.java:406)
at android.os.Parcel.nativeReadString(Parcel.java)
at android.os.Parcel$ReadWriteHelper.readString(Parcel.java:375)
at android.os.Parcel.readString(Parcel.java:1996)
at android.content.pm.ApplicationInfo.__constructor__(ApplicationInfo.java:1571)
at android.content.pm.ApplicationInfo.(ApplicationInfo.java)
at android.content.pm.ApplicationInfo$1.createFromParcel(ApplicationInfo.java:1547)
at android.content.pm.ApplicationInfo$1.createFromParcel(ApplicationInfo.java:1545)
at android.content.pm.PackageInfo.__constructor__(PackageInfo.java:498)
at android.content.pm.PackageInfo.(PackageInfo.java)
at android.content.pm.PackageInfo$1.createFromParcel(PackageInfo.java:477)
[鈥

Most helpful comment

Getting a similar stack trace with a NPE with ShadowParcel.nativeReadInt() when testing Parcelables.

java.lang.NullPointerException
    at org.robolectric.shadows.ShadowParcel.nativeReadInt(ShadowParcel.java:362)
    at android.os.Parcel.nativeReadInt(Parcel.java)
    at android.os.Parcel.readInt(Parcel.java:2028)
    at android.os.Parcel.readStringList(Parcel.java:2565)
        ...

on Robolectric 4.3 on CI server. Only happened for the 1 out of 20 build variants. Is this related or should I open another issue?

Also, wanted to say thanks for 4.3 PAUSED LooperMode. It's allowed me make a regression UI test on JVM for a screen with a ViewPager in it backed by a modified FragmentStatePagerAdapter.

All 3 comments

Getting a similar stack trace with a NPE with ShadowParcel.nativeReadInt() when testing Parcelables.

java.lang.NullPointerException
    at org.robolectric.shadows.ShadowParcel.nativeReadInt(ShadowParcel.java:362)
    at android.os.Parcel.nativeReadInt(Parcel.java)
    at android.os.Parcel.readInt(Parcel.java:2028)
    at android.os.Parcel.readStringList(Parcel.java:2565)
        ...

on Robolectric 4.3 on CI server. Only happened for the 1 out of 20 build variants. Is this related or should I open another issue?

Also, wanted to say thanks for 4.3 PAUSED LooperMode. It's allowed me make a regression UI test on JVM for a screen with a ViewPager in it backed by a modified FragmentStatePagerAdapter.

We (Pinterest) are seeing flaky CI tests due to similar exceptions:

java.lang.NullPointerException: (No message provided)Close stacktrace
at org.robolectric.shadows.ShadowParcel.nativeReadString(ShadowParcel.java:406)
at android.os.Parcel.nativeReadString(Parcel.java)
at android.os.Parcel$ReadWriteHelper.readString(Parcel.java:375)
at android.os.Parcel.readString(Parcel.java:1996)
at android.content.pm.PackageInfo.__constructor__(PackageInfo.java:487)
at android.content.pm.PackageInfo.<init>(PackageInfo.java)
at android.content.pm.PackageInfo$1.createFromParcel(PackageInfo.java:477)
at android.content.pm.PackageInfo$1.createFromParcel(PackageInfo.java:474)
at org.robolectric.shadows.ShadowApplicationPackageManager.newPackageInfo(ShadowApplicationPackageManager.java:417)
...

Actually just re-read the original ticket and this might be a different issue.

Hi all, any updates from your end? We are having the same issue (NullPointerException from nativeReadString)

Was this page helpful?
0 / 5 - 0 ratings