Sunday, May 22, 2016

Apps Crashing with phonegap-plugin-push and Google Play Services 9.0.0

Late last week Google pushed a new version of Google Play Services out to phones and since them some users of the phonegap-plugin-push have been seeing crashes in their app. The stack trace for that crash looks like this:

05-22 16:21:42.868 10979 11117 E AndroidRuntime: java.lang.IncompatibleClassChangeError: The method 'java.io.File android.support.v4.content.ContextCompat.getNoBackupFilesDir(android.content.Context)' was expected to be of type virtual but instead was found to be of type direct (declaration of 'com.google.android.gms.iid.zzd' appears in /data/app/io.cordova.hellocordova-1/base.apk)
05-22 16:21:42.868 10979 11117 E AndroidRuntime: at com.google.android.gms.iid.zzd.zzeC(Unknown Source)
05-22 16:21:42.868 10979 11117 E AndroidRuntime: at com.google.android.gms.iid.zzd.(Unknown Source)
05-22 16:21:42.868 10979 11117 E AndroidRuntime: at com.google.android.gms.iid.zzd.(Unknown Source)
05-22 16:21:42.868 10979 11117 E AndroidRuntime: at com.google.android.gms.iid.InstanceID.zza(Unknown Source)
05-22 16:21:42.868 10979 11117 E AndroidRuntime: at com.google.android.gms.iid.InstanceID.getInstance(Unknown Source)
05-22 16:21:42.868 10979 11117 E AndroidRuntime: at com.adobe.phonegap.push.PushPlugin$1.run(PushPlugin.java:75)
05-22 16:21:42.868 10979 11117 E AndroidRuntime: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
05-22 16:21:42.868 10979 11117 E AndroidRuntime: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
05-22 16:21:42.868 10979 11117 E AndroidRuntime: at java.lang.Thread.run(Thread.java:818)
05-22 16:21:42.882  5060  6828 W ActivityManager:   Force finishing activity io.cordova.hellocordova/.MainActivity
The crash is being cause because of a incompatibility between the newly released Google Play Services and Android Support Library v4. The phonegap-plugin-push does not use Android Support Library v4 but another plugin in your app may. You can check by doing:
grep -r com.android.support plugins
To see which other plugin is using Android Support Library v4. Removing that plugin, recompile and reinstall the application fixes the problem. Obviously this is not a desired or long term fix. Trying to figure out a way to prevent this but I fear we will require a new version of Android Support Library v4 from Google.

Subscribe to the Issue #909 on the plugin's repo for more info and updates.

No comments:

Post a Comment