Pushwoosh / pushwoosh-phonegap-plugin

Pushwoosh PhoneGap Build Plugin
Other
110 stars 139 forks source link

FATAL EXCEPTION on AndroidRuntime: IntentService[GCMRegistrationService] #182

Closed vdias38 closed 8 years ago

vdias38 commented 8 years ago

pushwoosh plugin crash Android App on register, tested on:

See device logs below:

I/Pushwoosh(19469): [PushManager] This is android device
D/ActivityManager(  746): startService callerProcessName:com.meumobi.developer, calleePkgName: com.meumobi.developer
D/ActivityManager(  746): caller:android.app.ApplicationThreadProxy@c4df8a7, r.packageName :com.meumobi.developer
V/SamsungIME( 3877): onTrimMeomory Level = 20
D/Pushwoosh(19469): [RequestManager] Try To send: registerUser
D/SSRM:n  (  746): SIOP:: AP = 360, CUR = 193, LCD = 133
D/Pushwoosh(19469): [RequestManager] Try To send: getInApps
I/System.out(19469): (HTTPLog)-Static: isSBSettingEnabled false
I/System.out(19469): KnoxVpnUidStorageknoxVpnSupported API value returned is false
V/Pushwoosh(19469): [PushRegistrarGCM] number of receivers for com.meumobi.developer: 4
D/EnterpriseController(  182): netId is 0
D/Netd    (  182): getNetworkForDns: using netid 502 for uid 10131
I/System.out(19469): (HTTPLog)-Static: isSBSettingEnabled false
V/Pushwoosh(19469): [PushRegistrarGCM] Found 1 receivers for action com.google.android.c2dm.intent.RECEIVE
I/System.out(19469): KnoxVpnUidStorageknoxVpnSupported API value returned is false
D/EnterpriseController(  182): netId is 0
D/Netd    (  182): getNetworkForDns: using netid 502 for uid 10131
W/PluginManager(19469): THREAD WARNING: exec() call to PushNotification.onDeviceReady blocked the main thread for 65ms. Plugin should use CordovaInterface.getThreadPool().
D/PWCordovaPlugin(19469): Plugin Method Called: registerDevice
D/ActivityManager(  746): startService callerProcessName:com.meumobi.developer, calleePkgName: com.meumobi.developer
D/ActivityManager(  746): caller:android.app.ApplicationThreadProxy@2f1988fd, r.packageName :com.meumobi.developer
V/Pushwoosh(19469): [GCMRegistrationService] Intent action = com.pushwoosh.gcm.intent.REGISTER
D/PWCordovaPlugin(19469): Plugin Method Called: setApplicationIconBadgeNumber
D/Pushwoosh(19469): [ShortcutBadger] Finding badger
I/System.out(19469): KnoxVpnUidStorageknoxVpnSupported API value returned is false
E/Pushwoosh(19469): [ShortcutBadger] Returning badger:com.pushwoosh.thirdparty.shortcutbadger.impl.DefaultBadger
I/System.out(19469): KnoxVpnUidStorageknoxVpnSupported API value returned is false
E/AndroidRuntime(19469): FATAL EXCEPTION: IntentService[GCMRegistrationService]
E/AndroidRuntime(19469): Process: com.meumobi.developer, PID: 19469
E/AndroidRuntime(19469): 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 'java.lang.reflect.ArtMethod' appears in /system/framework/core-libart.jar)
E/AndroidRuntime(19469):    at com.google.android.gms.iid.zzd.zzeb(Unknown Source)
E/AndroidRuntime(19469):    at com.google.android.gms.iid.zzd.<init>(Unknown Source)
E/AndroidRuntime(19469):    at com.google.android.gms.iid.zzd.<init>(Unknown Source)
E/AndroidRuntime(19469):    at com.google.android.gms.iid.InstanceID.zza(Unknown Source)
E/AndroidRuntime(19469):    at com.google.android.gms.iid.InstanceID.getInstance(Unknown Source)
E/AndroidRuntime(19469):    at com.pushwoosh.GCMRegistrationService.register(GCMRegistrationService.java:37)
E/AndroidRuntime(19469):    at com.pushwoosh.GCMRegistrationService.onHandleIntent(GCMRegistrationService.java:106)
E/AndroidRuntime(19469):    at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65)
E/AndroidRuntime(19469):    at android.os.Handler.dispatchMessage(Handler.java:102)
E/AndroidRuntime(19469):    at android.os.Looper.loop(Looper.java:145)
E/AndroidRuntime(19469):    at android.os.HandlerThread.run(HandlerThread.java:61)
W/PluginManager(19469): THREAD WARNING: exec() call to PushNotification.setApplicationIconBadgeNumber blocked the main thread for 24ms. Plugin should use CordovaInterface.getThreadPool().
V/BroadcastQueue(  746): [background] Process cur broadcast BroadcastRecord{2bd77843 u0 android.intent.action.BADGE_COUNT_UPDATE qIdx=4} DELIVERED for app ProcessRecord{1e28a579 19048:com.sec.android.provider.badge/u0a52}
D/Badge::BadgeCountReceiver(19048): badge intent : Intent { act=android.intent.action.BADGE_COUNT_UPDATE flg=0x10 cmp=com.sec.android.provider.badge/.BadgeCountReceiver bqHint=4 (has extras) }
D/Badge::BadgeCountReceiver(19048): packageName: com.meumobi.developer, className: com.meumobi.developer.PhoneGap, count: 0
W/ActivityManager(  746):   Force finishing activity 1 com.meumobi.developer/.PhoneGap
D/Launcher.Model( 1172): reloadBadges entered.
D/MethodReflector(19048): notifyChange is called
D/Launcher.Model( 1172): reloadBadges entered.
D/BadgeProvider(19048): sendNotify entered. [uri] : content://com.sec.badge/apps
D/BadgeProvider(19048): sendNotify, [notify] : null
DimanAM commented 8 years ago

This exception is caused by inconsistant Google Play Services and Android Support library versions. Try updating your Android SDK.

vdias38 commented 8 years ago

the apk was not build on local but on build.phonegap.com environment. Do you know if a ticket was open to build.phonegap community about it ? It should occur to many people.

DimanAM commented 8 years ago

It is not good if you cannot control build environment. The only option is to wait until Adobe will update Android SDK on their servers. The 5.0.3 version of this plugin in a fact uses exact versions of Google libraries (which appeared not to be a great idea). If you still get the error above then probably some other plugin references latest Android support library or it was referenced by Android project itself through com.android.support:appcompat-v7.

shaders commented 8 years ago

More details here: https://developers.google.com/android/guides/releases

Looks like Google broke 9.0 and fixed this in 9.0.1

vdias38 commented 8 years ago

PGB has deployed the latest Android SDK the 30th May but the issue remains. On build logs it seems that the last v4 (v4:24 beta1) android support lib is used:

:prepareComAndroidSupportSupportV42400Beta1Library
:prepareComGoogleAndroidGmsPlayServicesBase840Library
:prepareComGoogleAndroidGmsPlayServicesBasement840Library
:prepareComGoogleAndroidGmsPlayServicesGcm840Library
:prepareComGoogleAndroidGmsPlayServicesLocation840Library
:prepareComGoogleAndroidGmsPlayServicesMaps840Library
:prepareComGoogleAndroidGmsPlayServicesMeasurement840Library
:prepareComPushwooshPushwoosh412Library

I've checked that only pushwoosh plugin references android support

$ grep -r com.android.support plugins

My device run Google Play services 9.0.83 and I used pushwoosh plugin 5.1.2 on cordova-android 4.1.1

For information, phonegap-plugin-push has updated its push.gradle to fix this issue:

...
configurations.all {
    resolutionStrategy {
        force 'com.android.support:support-v4:23.4.0'
    }
}
DimanAM commented 8 years ago

PGB has deployed the latest Android SDK the 30th May but the issue remains.

They have to do it again to check out latest 9.0.1 and 9.0.2 google play services which are compatible with android support v4:24 beta1.

I've checked that only pushwoosh plugin references android support

android support v4 is also automatically referenced by com.google.android.gms:play-services-location and com.android.support:appcompat-v7.

For information, phonegap-plugin-push has updated its push.gradle to fix this issue:

...
configurations.all {
    resolutionStrategy {
        force 'com.android.support:support-v4:23.4.0'
    }
}

It is not a good idea. It may result in various problems and conflicts with other plugins.

vdias38 commented 8 years ago

I've opened an issue to phonegap build support: All my recent Android build crash, since deploy of Google Play Services 9.x

The crash occurs on the exact moment the App registerDevice. If I hide the call to this function the App run normally. It's why I've dismissed other origin.

I can't find any release note of Google Play services 9.0.1 | 9.0.2. How to know compatibility issues between Google Play Services and android support lib ?

macdonst commented 8 years ago

@elbidone we need a fix from Google. In the meantime you can do what I've done for the phonegap-plugin-push https://github.com/phonegap/phonegap-plugin-push/issues/909

vdias38 commented 8 years ago

@macdonst I will test the workaround you've suggested, but it not solves the issue on build.phonegap (or I should do a fork and update my config.xml to use my fork instead npm package,... hum)

vdias38 commented 8 years ago

As you suggested @macdonst I've added following lines on push.gradle and it works!

Thanks a lot!!

configurations.all {
    resolutionStrategy {
        force 'com.android.support:support-v4:23.4.0'
    }
}
DimanAM commented 8 years ago

I can't find any release note of Google Play services 9.0.1 | 9.0.2. How to know compatibility issues between Google Play Services and android support lib ?

https://developers.google.com/android/guides/releases

  • Google Play services updated to 9.0.1

The Google Play services version 9.0.1 release is now available. This release fixes the following issues with the version 9.0.0 release:

  • Fixes a class change compilation error with ContextCompat.getNoBackupFilesDir().