Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-25930] Android: Crashing with runtime exception

GitHub Issuen/a
TypeBug
PriorityNone
StatusOpen
ResolutionUnresolved
Affected Version/sRelease 7.1.0
Fix Version/sn/a
ComponentsAndroid
Labelsn/a
ReporterRene Pot
AssigneeGary Mathews
Created2018-04-04T15:58:45.000+0000
Updated2018-04-12T06:35:54.000+0000

Description

Android app keeps crashing for many users using the app created by [~zettageek] as contractor.
java.lang.RuntimeException: 
  at android.app.ActivityThread.handleReceiver (ActivityThread.java:3290)
  at android.app.ActivityThread.-wrap20 (ActivityThread.java)
  at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1715)
  at android.os.Handler.dispatchMessage (Handler.java:102)
  at android.os.Looper.loop (Looper.java:154)
  at android.app.ActivityThread.main (ActivityThread.java:6682)
  at java.lang.reflect.Method.invoke (Native Method)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:1520)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1410)
Caused by: java.lang.ClassNotFoundException: 
  at dalvik.system.BaseDexClassLoader.findClass (BaseDexClassLoader.java:56)
  at java.lang.ClassLoader.loadClass (ClassLoader.java:380)
  at java.lang.ClassLoader.loadClass (ClassLoader.java:312)
  at android.app.ActivityThread.handleReceiver (ActivityThread.java:3285)
SDK Version: 7.1.0.GA
Android Target SDK Version: 26
Hyperloop Enabled: YES (we use the Localytics-Hyperloop library on Github)
Facebook SDK In User: YES
Push Notifications: YES (Via Plot Projects)
Attached to Axway Platform: YES
Alloy Framework In Use: YES
Android Permissions In Use:
<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.GET_ACCOUNTS"/>
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE"/>
<uses-permission android:name="com.my.app.permission.C2D_MESSAGE"/>
<permission android:name="com.my.app.permission.C2D_MESSAGE" android:protectionLevel="signature"/>
<uses-feature android:name="android.hardware.camera"/>
<uses-feature android:name="android.hardware.camera.autofocus"/>
*Further information:* We also use GCM receivers. AppCompat as base Android theme. run-on-main-thread is TRUE. as is intent-filter-new-task = TRUE

Attachments

FileDateSize
AndroidManifest.xml2018-04-04T21:22:19.000+00007430
main-dex-classes.txt2018-04-04T21:22:19.000+000041219

Comments

  1. Joshua Quick 2018-04-04

    It looks like the system is failing to find a BroadcastReceiver Java class for a broadcasted intent. Questions:

    Are there any other broadcast receivers other than GCM (push notifications) set up in the app? (Ex: activity intent-filters, facebook deep-linking, etc.)

    Is the app multidex'ed? (After doing a build, check the build/android/bin/dexfiles folder for multiple dex files.)

    Do you have info regarding which Android OS versions this tends to happen on? We're looking for trends such as Android 4.x only or Android 8.x only.

    Thanks.
  2. Gary Mathews 2018-04-06

    [~zettageek] I received a crash after turning on my phone, Android 7.1.1:
       E/TiApplication: (main) [8,3408] Sending event: exception on thread: main msg:java.lang.RuntimeException: Unable to instantiate receiver com.localytics.gcm.GCMBroadcastReceiver: java.lang.ClassNotFoundException: Didn't find class "com.localytics.gcm.GCMBroadcastReceiver" on path: DexPathList[[zip file "/data/app/com.redacted.app-1/base.apk"],nativeLibraryDirectories=[/data/app/com.redacted.app-1/lib/arm64, /data/app/com.redacted.app-1/base.apk!/lib/arm64-v8a, /system/lib64, /vendor/lib64]]; Titanium 7.1.0,2018/03/14 13:40,undefined
           java.lang.RuntimeException: Unable to instantiate receiver com.localytics.gcm.GCMBroadcastReceiver: java.lang.ClassNotFoundException: Didn't find class "com.localytics.gcm.GCMBroadcastReceiver" on path: DexPathList[[zip file "/data/app/com.redacted.app-1/base.apk"],nativeLibraryDirectories=[/data/app/com.redacted.app-1/lib/arm64, /data/app/com.redacted.app-1/base.apk!/lib/arm64-v8a, /system/lib64, /vendor/lib64]]
               at android.app.ActivityThread.handleReceiver(ActivityThread.java:3046)
               at android.app.ActivityThread.-wrap18(ActivityThread.java)
               at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1580)
               at android.os.Handler.dispatchMessage(Handler.java:102)
               at android.os.Looper.loop(Looper.java:154)
               at android.app.ActivityThread.main(ActivityThread.java:6186)
               at java.lang.reflect.Method.invoke(Native Method)
               at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:889)
               at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:779)
            Caused by: java.lang.ClassNotFoundException: Didn't find class "com.localytics.gcm.GCMBroadcastReceiver" on path: DexPathList[[zip file "/data/app/com.redacted.app-1/base.apk"],nativeLibraryDirectories=[/data/app/com.redacted.app-1/lib/arm64, /data/app/com.redacted.app-1/base.apk!/lib/arm64-v8a, /system/lib64, /vendor/lib64]]
               at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
               at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
               at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
               at android.app.ActivityThread.handleReceiver(ActivityThread.java:3041)
               at android.app.ActivityThread.-wrap18(ActivityThread.java) 
               at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1580) 
               at android.os.Handler.dispatchMessage(Handler.java:102) 
               at android.os.Looper.loop(Looper.java:154) 
               at android.app.ActivityThread.main(ActivityThread.java:6186) 
               at java.lang.reflect.Method.invoke(Native Method) 
               at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:889) 
               at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:779)
       
    Your localytics broadcast receiver does not exist. After taking a look at the localytics module I found the correct class to use:
       <receiver android:name="com.localytics.gcm.GCMBroadcastReceiver" android:permission="com.google.android.c2dm.permission.SEND">
       
       <!--- REPLACE WITH --->
       
       <receiver android:name="com.localytics.android.GcmReceiver" android:permission="com.google.android.c2dm.permission.SEND">
       
  3. Joshua Quick 2018-04-07

    Note that you can reproduce this issue by rebooting your phone. This is because the BroadcastReceiver mentioned by Gary is set up to be invoked when the phone has been booted-up.
  4. Josh Lambert 2018-04-11

    Hey guys! We're unable to reproduce this on our end still, even after a reboot. Is there anything special we should do besides rebooting the device?
  5. Joshua Quick 2018-04-12

    [~zettageek], that would suggest some other BroadcastReceiver is configured wrong in the "AndroidManifest.xml" file. One that's not set up to listen for a "android.intent.action.BOOT_COMPLETED" intent. Is the "AndroidManifest.xml" file attached to this ticket yours? Each <receiver> XML element's name attribute references a Java class that the OS will attempt to instantiate via Java reflection. It's the fully qualified Java class name, which includes the package name (aka: namespace). I suspect one of the receiver names are wrong, has a typo, or has been renamed within a module. Meaning, to double check, a matching Java class needs to be found for each receiver name. Odds are there is a mismatch with one of the modules you're using.

JSON Source