caffeinalab / ti.goosh

GCM/FCM module for Titanium.
MIT License
52 stars 34 forks source link

unregisterForPushNotifications causes crash with suplied Google Play Services JARs #56

Closed hannta closed 7 years ago

hannta commented 7 years ago

I try to unregister push notifications, when I call TiGoosh.unregisterForPushNotifications() I get the following crash:

 FATAL EXCEPTION: AsyncTask #2
 Process: com.xxx.yyy, PID: 8258
 java.lang.RuntimeException: An error occurred while executing doInBackground()
    at android.os.AsyncTask$3.done(AsyncTask.java:309)
    at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354)
    at java.util.concurrent.FutureTask.setException(FutureTask.java:223)
    at java.util.concurrent.FutureTask.run(FutureTask.java:242)
    at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
    at java.lang.Thread.run(Thread.java:818)
 Caused by: java.lang.NoSuchMethodError: No virtual method deleteToken(Ljava/lang/String;Ljava/lang/String;)V in class Lcom/google/android/gms/iid/InstanceID; or its super classes (declaration of 'com.google.android.gms.iid.InstanceID' appears in /data/app/com.xxx.yyy-1/base.apk)
    at ti.goosh.TiGooshModule$1.doInBackground(TiGooshModule.java:148)
    at ti.goosh.TiGooshModule$1.doInBackground(TiGooshModule.java:144)
    at android.os.AsyncTask$2.call(AsyncTask.java:295)
    at java.util.concurrent.FutureTask.run(FutureTask.java:237)
    ... 4 more

Im using supplied Google Play Services JARs (gps-jars/google-play-services-gcm+maps.jar)

I tink the root of the issue is in proguard confs (eg. gps-jars/gcm+maps.conf), they should also keep com.google.android.gms.iid.InstanceID calss?

kopiro commented 7 years ago

yes, this could be the issue. did you try including it?

hannta commented 7 years ago

Yes, including com.google.android.gms.iid.** did the trick.

-keep public class com.google.android.gms.iid.** {
 public protected *;
}

This is actually already included in ti.goosh/android/proguard/proguard.conf but missing from ti.goosh/gps-jars/gcm+*.conf confs.