Pushwoosh / pushwoosh-phonegap-plugin

Pushwoosh PhoneGap Build Plugin
Other
110 stars 139 forks source link

Plugin crashes Android app #177

Closed sarpay closed 8 years ago

sarpay commented 8 years ago

Everything was working just right until couple days back. Plugin calls like registerDevice and unregisterDevice are causing app to crash without being able to produce an exception in debug mode. (using the Visual Studio Telerik AppBuilder client). Is this a known issue? Has anyone encountered a similar problem lately? Tested on Android 6.

Lecramed commented 8 years ago

Yes we have the same problem! Our app crashes on regesterDevice. Do we have to update our plugin?

shaders commented 8 years ago

Do you have crash log from the phone console?

named8 commented 8 years ago

Hi, we have the same problem. in my logacat there is this message: "FATAL EXCEPTION: IntentService[GCMRegistrationService]".

iwantwin commented 8 years ago

We have the same problem! I do not have any recent log messages, but we downgraded to an older version of the plugin to escape from the problems.

shaders commented 8 years ago

@iwantwin @Lecramed @sarpay @named8 Could you please provide the full logs from the device?

named8 commented 8 years ago

In attach a part of my LogCat logcat.txt

shaders commented 8 years ago

05-24 17:55:58.688: E/AndroidRuntime(23600): FATAL EXCEPTION: IntentService[GCMRegistrationService] 05-24 17:55:58.688: E/AndroidRuntime(23600): Process: *****_, PID: 23600 05-24 17:55:58.688: E/AndroidRuntime(23600): 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) 05-24 17:55:58.688: E/AndroidRuntime(23600): at com.google.android.gms.iid.zzd.zzeC(Unknown Source) 05-24 17:55:58.688: E/AndroidRuntime(23600): at com.google.android.gms.iid.zzd.(Unknown Source) 05-24 17:55:58.688: E/AndroidRuntime(23600): at com.google.android.gms.iid.zzd.(Unknown Source) 05-24 17:55:58.688: E/AndroidRuntime(23600): at com.google.android.gms.iid.InstanceID.zza(Unknown Source) 05-24 17:55:58.688: E/AndroidRuntime(23600): at com.google.android.gms.iid.InstanceID.getInstance(Unknown Source) 05-24 17:55:58.688: E/AndroidRuntime(23600): at com.pushwoosh.GCMRegistrationService.register(GCMRegistrationService.java:37) 05-24 17:55:58.688: E/AndroidRuntime(23600): at com.pushwoosh.GCMRegistrationService.onHandleIntent(GCMRegistrationService.java:106) 05-24 17:55:58.688: E/AndroidRuntime(23600): at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65) 05-24 17:55:58.688: E/AndroidRuntime(23600): at android.os.Handler.dispatchMessage(Handler.java:102) 05-24 17:55:58.688: E/AndroidRuntime(23600): at android.os.Looper.loop(Looper.java:145) 05-24 17:55:58.688: E/AndroidRuntime(23600): at android.os.HandlerThread.run(HandlerThread.java:61) 05-24 17:55:58.688: W/ActivityManager(967): Force finishing activity 1 *_****/.MainActivity

Ok, it looks like google play services library you use is outdated :(

The Pushwoosh plugin references the latest library as per Cordova guides: framework src="com.google.android.gms:play-services-gcm:+"

If using Intel XDK - you have to upgrade to the latest version of Intel XDK. If using any other builder - this might happen if any other plugin has outdated Google Play Services.jar file. You have to remove google-play-services.jar references/files from other plugins. You may ALSO need to update your Android SDK, especially Google Play Services.

Closing the thread now.

shaders commented 8 years ago

Oh yes, you also need to update Android Support Library as per my comment above:

The plugin references the latest version of Android Support Library: framework src="com.android.support:support-v4:+

named8 commented 8 years ago

Yes but I have already update the Android Support Library as you can seen in the picture. image I also installed Android 6.0 and 5.1

shaders commented 8 years ago

@named8 can you try the latest plugin? We've added minimum play/support library versions. This should help. Are there any other plugins you have by the way in your project which references these libraries?

shaders commented 8 years ago

This is what I have:

cd platforms/android ./gradlew :dependencies

releaseApk - ## Internal use, do not manually configure ## +--- com.google.android.gms:play-services-gcm:8.4.0 | +--- com.google.android.gms:play-services-base:8.4.0 | | --- com.google.android.gms:play-services-basement:8.4.0 | | --- com.android.support:support-v4:23.0.0 -> 23.1.0 | | --- com.android.support:support-annotations:23.1.0 | --- com.google.android.gms:play-services-measurement:8.4.0 | --- com.google.android.gms:play-services-basement:8.4.0 () +--- com.google.android.gms:play-services-location:8.4.0 | +--- com.google.android.gms:play-services-base:8.4.0 () | --- com.google.android.gms:play-services-maps:8.4.0 | --- com.google.android.gms:play-services-base:8.4.0 () +--- com.pushwoosh:pushwoosh:4.1.2 +--- com.android.support:support-v4:23.1.0 (_) --- project :CordovaLib

named8 commented 8 years ago

where can I check this references? I use cordova in the command. Thanks

DimanAM commented 8 years ago

@named8 Just run

cordova build android
cd platforms/android
./gradlew :dependencies
named8 commented 8 years ago

Perhaps I didn't understand, but if I run in command:

cordova build android cd platforms/android ./gradlew :dependencies

return this message error: "Error: Unknown platforms: cd, platforms/android, ./gradlew, :dependencies"

named8 commented 8 years ago

Any hint? thanks

DimanAM commented 8 years ago

@named8 These 3 lines are separate commands:

cordova build android
cd platforms/android
./gradlew :dependencies

If you want to run them in one line:

cordova build android && cd platforms/android && ./gradlew :dependencies

Alternatively you can open platforms/android in Android Studio and run in Terminal:

./gradlew :dependencies

(On Windows use gradlew.bat)

Lecramed commented 8 years ago

I use the telerik appbuilder verified plugin Is there a way to solve it in there?

named8 commented 8 years ago

I wrote your code in command: image

but return a error message: image

named8 commented 8 years ago

Please anyone can help me? This plugin it's important for my app and now if I add it my application became unusable. Thanks

shaders commented 8 years ago

Let me google it for you :) http://stackoverflow.com/questions/24216612/gradle-cannot-find-the-androidsdk-path-on-windows

named8 commented 8 years ago

@shaders thanks for your help (and your humor) but my problem with this plugin continues to exist. I have problem only with this plugin and only after his upgrade. I think is not possible is only dependencies problem.

shaders commented 8 years ago

The problem has been identified above. You are using different incompatible versions of Android Support V4 and Google Play Services from Android SDK.

I need the results of this gradleview command.

named8 commented 8 years ago

Ok thanks. Also with the correct instructions I have problem in command. I don't know

shaders commented 8 years ago

I think this might be an issue: https://github.com/Telerik-Verified-Plugins/Pushwoosh/issues/5

I think you need to update Telerik plugin to Pushwoosh plugin. They are using old old old fork of 3.6.16