freshplanet / ANE-Push-Notification

Air Native Extension (iOS and Android) for Push Notification
Apache License 2.0
205 stars 104 forks source link

My App Crashed when recieving GCM Message #32

Closed yjb94 closed 7 years ago

yjb94 commented 10 years ago

hi guys..

I sent GCM message from my server, and it makes my application crash right after I sent it. I think there is no wrong with my server code, Think sth is wrong with my manifest. can someone give me an answer?

my manifest looks like this

16bit ]]>
esdebon commented 10 years ago

The problem is when you sent the values in the JSON, you must submit:

contentTitle <---- this is the title contentText <---- this is the message tickerText <---- this is showed in the task bar

messi89 commented 10 years ago

Hi in my case application crash with push.sendLocalNotification(msg, (((seconde * 1000) + new Date().getTime())/1000), title);

esdebon commented 10 years ago

With me works fine (Android ans iOS), let me check, maybe there is a new version.

messi89 commented 10 years ago

which ane you use ? give me the link

esdebon commented 10 years ago

try this:

https://github.com/esdebon/ANE-Push-Notification/tree/feature/famepop-withOptions

messi89 commented 10 years ago

Same

When I get token [AirPushNotification] [StatusEvent type="status" bubbles=false cancelable=false eventPhase=2 code="LOGGING" level="Registered successfully with token: xxxx"] Registered successfully with token: xxxxx

app crashes

Devices : samsung tab 2 android 4.4.2, HTC android 4.1.2

esdebon commented 10 years ago

You can download the ADT (Android Developer Tools) to get the real device's log with Logcat option. http://developer.android.com/sdk/index.html?hl=sk

tontonpiero commented 10 years ago

Hi, Same issue for me, app crashes when receiving a GCM message. Device : Samsung galaxy SII, Android CyanogenMod 4.4.1 This is what Logcat says: E/AndroidRuntime(19486): java.lang.NoClassDefFoundError: android.support.v4.app.NotificationCompat$Builder E/AndroidRuntime(19486): at com.freshplanet.nativeExtensions.CreateNotificationTask.onPostExecute(Unknown Source) E/AndroidRuntime(19486): at com.freshplanet.nativeExtensions.CreateNotificationTask.onPostExecute(Unknown Source) E/AndroidRuntime(19486): at android.os.AsyncTask.finish(AsyncTask.java:632) E/AndroidRuntime(19486): at android.os.AsyncTask.access$600(AsyncTask.java:177) E/AndroidRuntime(19486): at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:645) E/AndroidRuntime(19486): at android.os.Handler.dispatchMessage(Handler.java:102) E/AndroidRuntime(19486): at android.os.Looper.loop(Looper.java:136) E/AndroidRuntime(19486): at android.app.ActivityThread.main(ActivityThread.java:5081) E/AndroidRuntime(19486): at java.lang.reflect.Method.invokeNative(Native Method) E/AndroidRuntime(19486): at java.lang.reflect.Method.invoke(Method.java:515) E/AndroidRuntime(19486): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:781) E/AndroidRuntime(19486): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597) E/AndroidRuntime(19486): at dalvik.system.NativeStart.main(Native Method) Thanks

esdebon commented 10 years ago

In the piece of log that you send, does not mention that your app is crashing, are you sure you are sending the data required?

you need send the values in a JSON:

contentTitle <---- this is the title contentText <---- this is the message tickerText <---- this is showed in the task bar

tontonpiero commented 10 years ago

The app is working fine with the master branch of the project. I receive push notifications without crash. But I need a way to get the "startingFromNotificationEvent", and it is only available in the "cleaning" or "famepop" branches. I tried all and I always get this issue.

More logs: I/GCM ( 6007): GCM message air.com.gerwinsoftware.superbuzzer 0:1401780977090892%11219dede2946b02 D/AirPushNotification( 1512): Received push notification with parameters: {"tickerText":"Partie privee","collapse_key":"playNow","parameters":{"code":"KROO"},"from":"77084017635","contentTitle":"Partie privee","contentText":"Code : KROO"} E/dalvikvm( 1512): Could not find class 'android.support.v4.app.NotificationCompat$Builder', referenced from method com.freshplanet.nativeExtensions.CreateNotificationTask.onPostExecute W/dalvikvm( 1512): VFY: unable to resolve new-instance 216 (Landroid/support/v4/app/NotificationCompat$Builder;) in Lcom/freshplanet/nativeExtensions/CreateNotificationTask; D/dalvikvm( 1512): VFY: replacing opcode 0x22 at 0x008f D/dalvikvm( 1512): DexOpt: unable to opt direct call 0x03f8 at 0x93 in Lcom/freshplanet/nativeExtensions/CreateNotificationTask;.onPostExecute I/air.com.gerwinsoftware.superbuzzer( 1512): [StatusEvent type="status" bubbles=false cancelable=false eventPhase=2 code="LOGGING" level="Received push notification with parameters: {"tickerText":"Partie privee","collapse_key":"playNow","parameters":{"code":"KROO"},"from":"77084017635","contentTitle":"Partie privee","contentText":"Code : KROO"}"] Received push notification with parameters: {"tickerText":"Partie privee","collapse_key":"playNow","parameters":{"code":"KROO"},"from":"77084017635","contentTitle":"Partie privee","contentText":"Code : KROO"} D/AndroidRuntime( 1512): Shutting down VM W/dalvikvm( 1512): threadid=1: thread exiting with uncaught exception (group=0x4197bc68) --------- beginning of /dev/log/system E/AndroidRuntime( 1512): FATAL EXCEPTION: main E/AndroidRuntime( 1512): Process: air.com.gerwinsoftware.superbuzzer, PID: 1512 E/AndroidRuntime( 1512): java.lang.NoClassDefFoundError: android.support.v4.app.NotificationCompat$Builder E/AndroidRuntime( 1512): at com.freshplanet.nativeExtensions.CreateNotificationTask.onPostExecute(Unknown Source) E/AndroidRuntime( 1512): at com.freshplanet.nativeExtensions.CreateNotificationTask.onPostExecute(Unknown Source) E/AndroidRuntime( 1512): at android.os.AsyncTask.finish(AsyncTask.java:632) E/AndroidRuntime( 1512): at android.os.AsyncTask.access$600(AsyncTask.java:177) E/AndroidRuntime( 1512): at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:645) E/AndroidRuntime( 1512): at android.os.Handler.dispatchMessage(Handler.java:102) E/AndroidRuntime( 1512): at android.os.Looper.loop(Looper.java:136) E/AndroidRuntime( 1512): at android.app.ActivityThread.main(ActivityThread.java:5081) E/AndroidRuntime( 1512): at java.lang.reflect.Method.invokeNative(Native Method) E/AndroidRuntime( 1512): at java.lang.reflect.Method.invoke(Method.java:515) E/AndroidRuntime( 1512): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:781) E/AndroidRuntime( 1512): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597) E/AndroidRuntime( 1512): at dalvik.system.NativeStart.main(Native Method) W/ActivityManager( 2266): Force finishing activity air.com.gerwinsoftware.superbuzzer/.AppEntry

esdebon commented 10 years ago

Could not find class 'android.support.v4.app.NotificationCompat$Builder', You can recompile the ane adding this class

Mi trick to solve this problem is importing the the fresh planet facebook ane to my project... so if I understand this ane has the updated class and that makes it work

tontonpiero commented 10 years ago

Ok! I found (thanks to you and the FreshPlanet Facebook project) that there are missing lines in the build.xml file:

<mkdir dir="../android/temp/zip"/>
<unzip src="../android/libs/android-support-v4.jar" dest="../android/temp/zip"/>
<copydir src="../android/temp/zip/android" dest="../android/temp/classes/android"/>

This adds all content of the android-support-v4.jar file in the compiled jar file.

The sad part is that when I rebuild the ANE file and try it I get an other weird error:

E/AndroidRuntime(13367): java.lang.RuntimeException: Unable to instantiate receiver com.freshplanet.nativeExtensions.C2DMBroadcastReceiver: java.lang.ClassNotFoundException: Didn't find class "com.freshplanet.nativeExtensions.C2DMBroadcastReceiver" on path: DexPathList[[zip file "/mnt/asec/air.com.gerwinsoftware.superbuzzer-1/pkg.apk"],nativeLibraryDirectories=[/mnt/asec/air.com.gerwinsoftware.superbuzzer-1/lib, /vendor/lib, /system/lib]]

I would really appreciate if you apply the fix, build the ANE and update the github project. It would save me hours (days?) of debug... :)

Thanks!

satishgowda28 commented 10 years ago

image

and im not able to rebuild ane using ant giving some errors

juliocanares commented 9 years ago

check this https://github.com/juliocanares/ANE-Push-Notification/commit/09a4720645a2306ed1800bcd7e820484bafc3994 and recompile

dragonwhites commented 9 years ago

Thanks @juliocanares

irinelpascu commented 9 years ago

I think I managed to fix it. It works for my app. Let me know. https://drive.google.com/folderview?id=0B6nEmghkuTbZMWc4VGw5alp5Zms&usp=sharing

DamboRam commented 9 years ago

Hey @pascomach00 i have download your ane. When i run debug mode a popup is show with below problem : Problem occured Error occurred while packaging the application:

dx tool failed: UNEXPECTED TOP-LEVEL EXCEPTION: java.lang.IllegalArgumentException: already added: Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoIcsImpl; at com.android.dx.dex.file.ClassDefsSection.add(ClassDefsSection.java:123) at com.android.dx.dex.file.DexFile.add(DexFile.java:143) at com.android.dx.command.dexer.Main.processClass(Main.java:301) at com.android.dx.command.dexer.Main.processFileBytes(Main.java:278) at com.android.dx.command.dexer.Main.access$100(Main.java:56) at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:229) at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:244) at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:130) at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:108) at com.android.dx.command.dexer.Main.processOne(Main.java:247) at com.android.dx.command.dexer.Main.processAllFiles(Main.java:183) at com.android.dx.command.dexer.Main.run(Main.java:139) at com.android.dx.command.dexer.Main.main(Main.java:120) at com.android.dx.command.Main.main(Main.java:89) 1 error; aborting

irinelpascu commented 9 years ago

This problem may be because you have another ANE that also tries to import the same library (probably android-support-v4.jar). Can you write a list of all the anes you are using or check for yourself their content (i use winrar to open anes)?

DamboRam commented 9 years ago

Hey @pascomach00 thanks for your reply. True i'm using freshplanet AirFacebook.ane does not contain android-support-v4.jar, instead your ane contain android-support-v4.jar so i have removed android-support-v4.jar from your ane and the app run . But when sending the push notification the app received the below message in the log and crashed: [StatusEvent type="status" bubbles=false cancelable=false eventPhase=2 code="LOGGING" level="Received push notification with parameters: {"tickerText ":"asdf @ asdfasdf","contentText ":"asdf @ asdfasdf","collapse_key":"do_not_collapse","from":"570916618362","contentTitle ":"PromoScope"}"] Received push notification with parameters: {"tickerText ":"asdf @ asdfasdf","contentText ":"asdf @ asdfasdf","collapse_key":"do_not_collapse","from":"570916618362","contentTitle ":"PromoScope"}

Any idea why the app is crashing ? i'm using your ane + flex sdk 4.13 with air15.0

AmirSmarty commented 6 years ago

A Fix for firebase?