HMS-Core / hms-react-native-plugin

This repo contains all of React-Native HMS plugins.
https://developer.huawei.com/consumer/en/doc/overview/HMS-Core-Plugin?ha_source=hms1
Apache License 2.0
241 stars 68 forks source link

App crashes on open after installing @hmscore/react-native-hms-push version 5.1.1-301 #117

Closed blexxed closed 3 years ago

blexxed commented 3 years ago

Description App crashes on open after installing @hmscore/react-native-hms-push version 5.1.1-301

Expected behavior App should not crash

Current behavior App crashes

Crash report: Fatal Exception: java.lang.NullPointerException Attempt to invoke virtual method 'android.content.Context android.content.Context.getApplicationContext()' on a null object reference com.huawei.hms.rn.push.logger.HMSLogger.getInstance com.huawei.hms.rn.push.logger.HMSLogger.getInstance (HMSLogger.java:100) com.huawei.hms.rn.push.remote.HmsPushMessageService.onTokenError (HmsPushMessageService.java:107) com.huawei.hms.push.HmsMessageService.a (HmsMessageService.java:34) com.huawei.hms.push.HmsMessageService.a (HmsMessageService.java:29) com.huawei.hms.push.HmsMessageService.handleIntentMessage (HmsMessageService.java:7) com.huawei.hms.push.HmsMessageService$a.handleMessage (HmsMessageService.java:7)

when I uninstall @hmscore/react-native-hms-push version 5.1.1-301. App does not crash anymore. Also downgrading @hmscore/react-native-hms-push to 5.0.2-301 works.

Environment

amjadbouhouch commented 3 years ago

Hi @blexxed, I'm facing this issue right now, is there any update?

ozcanozgur commented 3 years ago

Hi @blexxed, thank you for your interest in our Huawei Push React Native Plugin,

Could you give us more information about this error? Which state you faced with that issue?

We tried to upgrade old version demo with version "5.1.1-301" and there is no error like that.

I will share a link for you, could you please try our last version demo.

https://developer.huawei.com/consumer/en/doc/development/HMS-Plugin-Library-V1/reactnative-plugin-0000001050155850-V1

Krish143git commented 3 years ago

hi guys, i am also facing the same issue app is not opening in android,But it is working on hms core apk presented device ,but not working in google service device.And also when i uninstall hms-push pkg it is opening in google service phones and when i install it is not opening in google service phones

this is the logcat i am getting in android studio when opening

Attempt to invoke virtual method 'android.content.Context android.content.Context.getApplicationContext()' on a null object reference at com.huawei.hms.rn.push.logger.HMSLogger.getInstance(HMSLogger.java:100) at com.huawei.hms.rn.push.remote.HmsPushMessageService.onTokenError(HmsPushMessageService.java:107) at com.huawei.hms.push.HmsMessageService.a(HmsMessageService.java:34) at com.huawei.hms.push.HmsMessageService.a(HmsMessageService.java:29) at com.huawei.hms.push.HmsMessageService.handleIntentMessage(HmsMessageService.java:7) at com.huawei.hms.push.HmsMessageService$a.handleMessage(HmsMessageService.java:7) at android.os.Handler.dispatchMessage(Handler.java:107) at android.os.Looper.loop(Looper.java:238) at android.app.ActivityThread.main(ActivityThread.java:7878) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:512) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1028)

m1kys commented 3 years ago

I have the same issues after update ^

blexxed commented 3 years ago

Hi @blexxed, thank you for your interest in our Huawei Push React Native Plugin,

Could you give us more information about this error? Which state you faced with that issue?

We tried to upgrade old version demo with version "5.1.1-301" and there is no error like that.

I will share a link for you, could you please try our last version demo.

https://developer.huawei.com/consumer/en/doc/development/HMS-Plugin-Library-V1/reactnative-plugin-0000001050155850-V1

Hi @ozcanozgur,

I checked the example demo app. I noticed that the react native version is 0.60.0 https://github.com/HMS-Core/hms-react-native-plugin/blob/master/react-native-hms-push/example/package.json

The crash I encountered is on fresh react native install with a more recent version of 0.64.1

nolife08021 commented 3 years ago

@blexxed @ozcanozgur "react-native": "0.61.2". facing same issue.

ozcanozgur commented 3 years ago

hi @all,

We have fixed the problem. The new version will be released on the next month.

For a quick fix auto_init should be false.

image

image

https://developer.huawei.com/consumer/en/doc/development/HMSCore-Guides-V5/android-client-dev-0000001050042041-V5#EN-US_TOPIC_0000001133945413__section13546121751811

Thank you.

blexxed commented 3 years ago

Hello @ozcanozgur, are there any updates on this?

ozcanozgur commented 3 years ago

Hi @all,

The new version of push kit plugin released.

https://www.npmjs.com/package/@hmscore/react-native-hms-push https://github.com/HMS-Core/hms-react-native-plugin/tree/master/react-native-hms-push

Thank You.