I am writing an ionic app that uses both GCM notifications and parse push. This app is using these plugins:
com.ionic.keyboard 1.0.3 "Keyboard"
com.phonegap.plugins.PushPlugin 2.4.0 "PushPlugin"
org.apache.cordova.core.parseplugin 0.1.0 "phonegap-parse-plugin"
The app boots fine, but then crashes. I noticed the only time it crashes is when I push a notification, close the app, then reopen the app (whenever a notification is sitting in the queue to be pushed on app opening) and the app will crash immediately. I ran adb logcat and dug through the logs and found:
E/AndroidRuntime( 424): FATAL EXCEPTION: main
E/AndroidRuntime( 424): Process: com.oceans15.channel37, PID: 424
E/AndroidRuntime( 424): java.lang.RuntimeException: Unable to instantiate receiver com.parse.GcmBroadcastReceiver: java.lang.ClassNotFoundException: Didn't find class "com.parse.GcmBroadcastReceiver" on path: DexPathList[[zip file "/data/app/com.oceans15.channel37-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.oceans15.channel37-1, /vendor/lib, /system/lib]]
E/AndroidRuntime( 424): at android.app.ActivityThread.handleReceiver(ActivityThread.java:2518)
E/AndroidRuntime( 424): at android.app.ActivityThread.access$1800(ActivityThread.java:161)
E/AndroidRuntime( 424): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1341)
E/AndroidRuntime( 424): at android.os.Handler.dispatchMessage(Handler.java:102)
E/AndroidRuntime( 424): at android.os.Looper.loop(Looper.java:157)
E/AndroidRuntime( 424): at android.app.ActivityThread.main(ActivityThread.java:5356)
E/AndroidRuntime( 424): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 424): at java.lang.reflect.Method.invoke(Method.java:515)
E/AndroidRuntime( 424): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265)
E/AndroidRuntime( 424): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)
E/AndroidRuntime( 424): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime( 424): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.parse.GcmBroadcastReceiver" on path: DexPathList[[zip file "/data/app/com.oceans15.channel37-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.oceans15.channel37-1, /vendor/lib, /system/lib]]
E/AndroidRuntime( 424): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:67)
E/AndroidRuntime( 424): at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
E/AndroidRuntime( 424): at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
E/AndroidRuntime( 424): at android.app.ActivityThread.handleReceiver(ActivityThread.java:2513)
E/AndroidRuntime( 424): ... 10 more
W/ActivityManager( 817): Force finishing activity com.oceans15.channel37/.CordovaApp
I/IcingCorporaProvider( 6900): UpdateCorporaTask done [took 287 ms] updated apps [took 287 ms]
W/DropBoxManagerService( 817): Dropping: data_app_crash (1735 > 0 bytes)
I have read other topics with this issue, but they are all java related. In my case, I am using ionic/cordova, and if I were to manually edit the files, they would be replaced the next time the app is generated in the build. Has anyone else ran into this specific to a cordova/phonegap based project?
Edit: Since I have seen others post it, here is my manifest file. This is remade each time I build the app.
<?xml version='1.0' encoding='utf-8'?>
<manifest android:hardwareAccelerated="true" android:versionCode="1" android:versionName="0.0.1" package="com.oceans15.channel37" xmlns:android="http://schemas.android.com/apk/res/android">
<supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" />
<uses-permission android:name="android.permission.INTERNET" />
<application android:hardwareAccelerated="true" android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="@string/activity_name" android:launchMode="singleTop" android:name="CordovaApp" android:theme="@android:style/Theme.Black.NoTitleBar" android:windowSoftInputMode="adjustResize">
<intent-filter android:label="@string/launcher_name">
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service android:name="com.parse.PushService" />
<receiver android:name="com.parse.ParseBroadcastReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.USER_PRESENT" />
</intent-filter>
</receiver>
<receiver android:name="com.parse.GcmBroadcastReceiver" android:permission="com.google.android.c2dm.permission.SEND">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="com.ionicframework.prototype255671" />
</intent-filter>
</receiver>
<activity android:exported="true" android:name="com.plugin.gcm.PushHandlerActivity" />
<receiver android:name="com.plugin.gcm.CordovaGCMBroadcastReceiver" android:permission="com.google.android.c2dm.permission.SEND">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="com.ionicframework.prototype255671" />
</intent-filter>
</receiver>
<service android:name="com.plugin.gcm.GCMIntentService" />
</application>
<uses-sdk android:minSdkVersion="10" android:targetSdkVersion="19" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<permission android:name="com.ionicframework.prototype255671.permission.C2D_MESSAGE" android:protectionLevel="signature" />
<uses-permission android:name="com.ionicframework.prototype255671.permission.C2D_MESSAGE" />
</manifest>