oracle / pushiomanager-react-native

React Native Module for Responsys SDK
Universal Permissive License v1.0
15 stars 17 forks source link

Our Android users are receiving a java.lang.RuntimeException in com.pushio.manager.PIOAPIResultReceiver #16

Closed shamilovtim closed 3 years ago

shamilovtim commented 3 years ago

Hello!

Could you please provide a bugfix and an ETA for a resolution? Our users are receiving a crash in: com.pushio.manager.PIOAPIResultReceiver

Full stack trace:

java.lang.RuntimeException: An error occurred while executing doInBackground()
        at android.os.AsyncTask$4.done(AsyncTask.java:415)
        at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:383)
        at java.util.concurrent.FutureTask.setException(FutureTask.java:252)
        at java.util.concurrent.FutureTask.run(FutureTask.java:271)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:923)

Caused by: android.os.BadParcelableException: ClassNotFoundException when unmarshalling: com.pushio.manager.PIOAPIResultReceiver
        at android.os.Parcel.readParcelableCreator(Parcel.java:3376)
        at android.os.Parcel.readParcelable(Parcel.java:3284)
        at android.os.Parcel.readValue(Parcel.java:3186)
        at android.os.Parcel.readArrayMapInternal(Parcel.java:3579)
        at android.os.BaseBundle.initializeFromParcelLocked(BaseBundle.java:292)
        at android.os.BaseBundle.unparcel(BaseBundle.java:236)
        at android.os.BaseBundle.containsKey(BaseBundle.java:516)
        at android.content.Intent.hasExtra(Intent.java:8699)
        at com.pushio.manager.PIOAPIConnectorService.processRequest(PIOAPIConnectorService.java:49)
        at com.pushio.manager.PIOAPIConnectorService.onHandleIntent(PIOAPIConnectorService.java:43)
        at com.pushio.manager.PIOAPIConnectorService.onHandleWork(PIOAPIConnectorService.java:32)
        at androidx.core.app.JobIntentService$CommandProcessor.doInBackground(JobIntentService.java:392)
        at androidx.core.app.JobIntentService$CommandProcessor.doInBackground(JobIntentService.java:383)
        at android.os.AsyncTask$3.call(AsyncTask.java:394)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:923)

Galaxy S20 FE 5G (SM-G781U) Android 11 version 6.48

neerhaj commented 3 years ago

We are looking into this. Will update here once we know more.

neerhaj commented 3 years ago

Have you enabled ProGuard/R8 for the release build?

shamilovtim commented 3 years ago

Yes there is Proguard + R8.

Build rules:

    buildTypes {
        release {
            minifyEnabled true
            shrinkResources false
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
        }
        debug {
        }
    }

Proguard:

-dontwarn io.branch.**

# Important for Branch AAID/GAID attribution
-keep class com.google.android.gms.ads.identifier.** { *; }

-assumenosideeffects class android.util.Log {
    public static boolean isLoggable(java.lang.String, int);
    public static int v(...);
    public static int i(...);
    public static int w(...);
    public static int d(...);
    public static int e(...);
}

# Disabling obfuscation is useful if you collect stack traces from production crashes
# (unless you are using a system that supports de-obfuscate the stack traces).
# -dontobfuscate

# React Native

# Keep our interfaces so they can be used by other ProGuard rules.
# See http://sourceforge.net/p/proguard/bugs/466/
-keep,allowobfuscation @interface com.facebook.proguard.annotations.DoNotStrip
-keep,allowobfuscation @interface com.facebook.proguard.annotations.KeepGettersAndSetters
-keep,allowobfuscation @interface com.facebook.common.internal.DoNotStrip

 # Do not strip any method/class that is annotated with @DoNotStrip
-keep @com.facebook.proguard.annotations.DoNotStrip class *
-keep @com.facebook.common.internal.DoNotStrip class *
-keepclassmembers class * {
    @com.facebook.proguard.annotations.DoNotStrip *;
    @com.facebook.common.internal.DoNotStrip *;
}

-keepclassmembers @com.facebook.proguard.annotations.KeepGettersAndSetters class * {
  void set*(***);
  *** get*();
}

-keep class * extends com.facebook.react.bridge.JavaScriptModule { *; }
-keep class * extends com.facebook.react.bridge.NativeModule { *; }
-keepclassmembers,includedescriptorclasses class * { native <methods>; }
-keepclassmembers class *  { @com.facebook.react.uimanager.annotations.ReactProp <methods>; }
-keepclassmembers class *  { @com.facebook.react.uimanager.annotations.ReactPropGroup <methods>; }

-dontwarn com.facebook.react.**
-keep,includedescriptorclasses class com.facebook.react.bridge.** { *; }

# Hermes
-keep class com.facebook.hermes.unicode.** { *; }
-keep class com.facebook.jni.** { *; }

 # okhttp

-keepattributes Signature
-keepattributes *Annotation*
-keep class okhttp3.** { *; }
-keep interface okhttp3.** { *; }
-dontwarn okhttp3.**
# A resource is loaded with a relative path so the package of this class must be preserved.
-keepnames class okhttp3.internal.publicsuffix.PublicSuffixDatabase
# OkHttp platform used only on JVM and when Conscrypt dependency is available.
-dontwarn okhttp3.internal.platform.ConscryptPlatform

# okio

-keep class sun.misc.Unsafe { *; }
-dontwarn java.nio.file.*
-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
-dontwarn okio.**

# Bugsnag

-keepattributes SourceFile,LineNumberTable
-keep class com.bugsnag.android.NativeInterface { *; }
-keep class com.bugsnag.android.Breadcrumb { *; }
-keep class com.bugsnag.android.Breadcrumbs { *; }
-keep class com.bugsnag.android.Breadcrumbs$Breadcrumb { *; }
-keep class com.bugsnag.android.BreadcrumbType { *; }
-keep class com.bugsnag.android.Severity { *; }
-keep class com.bugsnag.android.ndk.BugsnagObserver { *; }

# React Native SVG
-keep public class com.horcrux.svg.** {*;}

# This will not obfuscate exception names, which is especially nice when looking
# at bugsnag

-keep public class * extends java.lang.Exception

# segment
-keep class com.segment.analytics.** { *; }
-keep class androidx.lifecycle.DefaultLifecycleObserver
neerhaj commented 3 years ago

ok. We believe that during the app build process, one of the classes required by the SDK is being removed by Proguard/R8, leading to the ClassNotFoundException seen above. And we need the problematic APK to verify this.

So, could you share the release build (APK) version which is showing this issue? And also the dependencies section from the build.gradle file?

shamilovtim commented 3 years ago

@neerhaj it's the Shipt app on Google play Store. Does that work for you?

shamilovtim commented 3 years ago

whole project build gradle

dependencies {
        classpath 'com.android.tools.build:gradle:4.0.1'
        classpath 'com.google.gms:google-services:4.3.8'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.bugsnag:bugsnag-android-gradle-plugin:5.+'
        classpath 'com.android.tools.build:bundletool:0.12.0'
        classpath 'com.google.firebase:perf-plugin:1.4.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }

app build gradle

dependencies {
    implementation fileTree(dir: 'src/main/libs', include: ['PushIOManager-6.48.1.aar'])
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation 'androidx.multidex:multidex:2.0.1' // Required for pre lollipop devices (pre ART)
    implementation "com.google.firebase:firebase-core"
    implementation 'com.google.firebase:firebase-messaging'
    implementation 'com.google.firebase:firebase-iid'
    implementation "androidx.core:core:$androidxLibVersion"
    implementation "androidx.appcompat:appcompat:$androidxLibVersion"

    //noinspection GradleDynamicVersion
    implementation "com.facebook.react:react-native:+"  // From node_modules

    // Add v8-android - prebuilt libv8android.so into APK
    implementation 'org.chromium:v8-android:+'

    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'com.google.android.play:core:1.10.0'
    implementation 'com.google.android.gms:play-services-base:16.1.0' // Responsys asked us to put this here

    implementation 'androidx.browser:browser:1.0.0' // Chrome Tab matching - Branch
    implementation 'com.google.android.gms:play-services-ads-identifier:16+' // GAID matching - Branch
    implementation 'com.google.firebase:firebase-appindexing' // App indexing - Branch
    // Testing dependencies
    if (rootProject.releaseStage == 'Dev') {
        androidTestImplementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
        androidTestImplementation "androidx.test:core:$testCoreVersion"
        androidTestImplementation "androidx.test:core-ktx:$testCoreVersion"
        androidTestImplementation "androidx.test.ext:junit:$extJUnitVersion"
        androidTestImplementation "androidx.test.ext:junit-ktx:$extJUnitVersion"
        androidTestImplementation "androidx.test:runner:$runnerVersion"
        androidTestImplementation "androidx.test.espresso:espresso-core:$espressoVersion"
    }

    debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.0-beta-3'

    implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"

    debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
        exclude group:'com.facebook.fbjni'
    }

    debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
        exclude group:'com.squareup.okhttp3', module:'okhttp'
        exclude group:'com.facebook.flipper'
    }

    debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") {
        exclude group:'com.facebook.flipper'
    }

    addUnimodulesDependencies()
}
shamilovtim commented 3 years ago

Here is an explicit link to an apks file: https://drive.google.com/file/d/1JLUDtuCTkypqcEzyngIsFWmgv5iufDG9/view?usp=sharing

neerhaj commented 3 years ago

The version on Google Play Store is 2.98.3. The version shared on Google Drive is 2.99.0.

I assume the issue is with 2.98.3?

shamilovtim commented 3 years ago

@neerhaj All versions have it. We haven't done anything new in 2.99.0 to stop this from occurring

neerhaj commented 3 years ago

I tried both 2.98.3 and 2.99.0, I did not see this issue.

Are there any steps or specific screen in the app which consistently shows this issue?

Are you able to reproduce this issue at your end?

shamilovtim commented 3 years ago

We see hundreds of users receiving this bug. I have another stack trace, this one is from the thread.

Thread 2 - main
        at java.util.HashMap.entrySet(HashMap.java:1008)
        at android.os.Parcel.writeMapInternal(Parcel.java:853)
        at android.os.Parcel.writeMap(Parcel.java:841)
        at android.os.Parcel.writeValue(Parcel.java:1592)
        at android.os.Parcel.writeArrayMapInternal(Parcel.java:891)
        at android.os.BaseBundle.writeToParcelInner(BaseBundle.java:1579)
        at android.os.Bundle.writeToParcel(Bundle.java:1233)
        at android.os.Parcel.writeBundle(Parcel.java:931)
        at android.content.Intent.writeToParcel(Intent.java:10643)
        at android.app.job.JobWorkItem.writeToParcel(JobWorkItem.java:201)
        at android.app.job.IJobScheduler$Stub$Proxy.enqueue(IJobScheduler.java:209)
        at android.app.JobSchedulerImpl.enqueue(JobSchedulerImpl.java:53)
        at androidx.core.app.JobIntentService$JobWorkEnqueuer.enqueueWork(JobIntentService.java:343)
        at androidx.core.app.JobIntentService.enqueueWork(JobIntentService.java:523)
        at androidx.core.app.JobIntentService.enqueueWork(JobIntentService.java:501)
        at com.pushio.manager.PIOAPIConnector.connectUrl(PIOAPIConnector.java:29)
        at com.pushio.manager.PIORequestManager.send(PIORequestManager.java:39)
        at com.pushio.manager.PIOBatchRequestManager.syncBatch(PIOBatchRequestManager.java:158)
        at com.pushio.manager.PIOBatchRequestManager.sendBatch(PIOBatchRequestManager.java:68)
        at com.pushio.manager.PIOBatchRequestManager.onConnectivityChanged(PIOBatchRequestManager.java:270)
        at com.pushio.manager.PIOConnectionManager.notifyConnectivityChange(PIOConnectionManager.java:83)
        at com.pushio.manager.PIOConnectivityReceiver.onReceive(PIOConnectivityReceiver.java:18)
        at android.app.LoadedApk$ReceiverDispatcher$Args.lambda$getRunnable$0(LoadedApk.java:1483)
        at android.app.-$$Lambda$LoadedApk$ReceiverDispatcher$Args$_BumDX2UKsnxLVrE6UJsJZkotuA.run(Unknown:2)
        at android.os.Handler.handleCallback(Handler.java:873)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:214)
        at android.app.ActivityThread.main(ActivityThread.java:7073)
        at java.lang.reflect.Method.invoke(Method.java:-2)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:964)

Here are some devices that are having the issue: Galaxy S8 Galaxy Note8 Galaxy Note9 Galaxy S8+ Galaxy S9 Galaxy S8 Active Galaxy s10e Galaxy Note20 Galaxy s20 Galaxy s21 LG G8 ThinQ LG LM-Q720 LG V50-ThinQ LG K40 and more

The error occurs in all Android versions but seems to be mainly Samsung and LG devices

In most cases this is the behavior that triggers it:

Screen Shot 2021-07-14 at 10 37 44 AM

It seems to be mainly app start

shamilovtim commented 3 years ago

Android 11:

Screen Shot 2021-07-14 at 4 26 38 PM

Android 10:

Screen Shot 2021-07-14 at 4 27 47 PM

Android 9:

Screen Shot 2021-07-14 at 4 27 13 PM