infobip / mobile-messaging-react-native-plugin

Mobile Messaging SDK plugin for React Native projects
24 stars 4 forks source link

Infobip react native sdk update Issue #33

Closed Rohit-Surawat closed 2 years ago

Rohit-Surawat commented 2 years ago

Hi All,

We are facing issue related to infobip sdk update, because of that we are facing multiple issue,

Existing Version: 2.2.0 Target Version :4.1.4

Current Implementation:

We have both android sdk and react native plugin in place for info bip notification handling.

  1. Infobip there is a module created in android which handles the saving user data, login, logout and handle push notifications.
  2. React native side it takes care of deep linking and routing in our application based on the notification type.

Now problem is when i upgrade there is conflict between 5.3.6 android sdk runtime which installed along with react native plugin and android sdk for infobip 4.0.2

tried upgrading the native sdk to 5.3.6 didn't help throws unable to resolve module.

Any help or guidance will be a great help For more info please feel free to comment Thanks & Regards Rohit

kostap13 commented 2 years ago

Hi @Rohit-Surawat Could you please provide more details about yours environment?

RN version, node version etc.

kostap13 commented 2 years ago

And also one other question

We have both android sdk and react native plugin in place for info bip notification handling.: Why do need such solution?

Maybe RN plugin 4.1.4 will cover all yours requirements?

riskpp commented 2 years ago

Hello @Rohit-Surawat, Could be that Mobile Messaging react-native plugin can cover all your requirements

Usage of the native SDK together with react-native plugin it's rarely seen use case, but we will try to reproduce the issue, could you please provide your versions (react-native version, node version), it'll help us to return with solution faster.

Rohit-Surawat commented 2 years ago

Hi @riskpp @kostap13 Sorry for delay in response , Let me provide you detail explanation,

We have native implementation in place for Android OS in our react native application.

Current Build Gradle Of Android : org.infobip.mobile.messaging.api:infobip-mobile-messaging-android-sdk:4.0.2@aar

React Native Plugin Version : "infobip-mobile-messaging-react-native-plugin": "2.2.0",

Now when i update to latest version android: com.infobip:infobip-mobile-messaging-android-sdk:5.3.6@aar

react native version "infobip-mobile-messaging-react-native-plugin": "4.1.6',

Application is. not starting at all getting following stack trace: java.lang.RuntimeException: Unable to create application java.lang.RuntimeException: Requested enabled DevSupportManager, but DevSupportManagerImpl class was not found or could not be created at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5743) at android.app.ActivityThread.-wrap1(Unknown Source:0) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1656) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6494) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807) Caused by: java.lang.RuntimeException: Requested enabled DevSupportManager, but DevSupportManagerImpl class was not found or could not be created at com.facebook.react.devsupport.b.a(SourceFile:90) at com.facebook.s0.p.(SourceFile:245) at com.facebook.s0.q.b(SourceFile:287) at com.facebook.s0.s.a(SourceFile:89) at com.facebook.s0.s.i(SourceFile:39) at MainApplication.onCreate(SourceFile:74) at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1119) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5740) at android.app.ActivityThread.-wrap1(Unknown Source:0) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1656) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6494) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807) Caused by: java.lang.ClassNotFoundException: com.facebook.react.devsupport.DevSupportManagerImpl at java.lang.Class.classForName(Native Method) at java.lang.Class.forName(Class.java:453) at java.lang.Class.forName(Class.java:378) at com.facebook.react.devsupport.b.a(SourceFile:68) at com.facebook.s0.p.(SourceFile:245) at com.facebook.s0.q.b(SourceFile:287) at com.facebook.s0.s.a(SourceFile:89) at com.facebook.s0.s.i(SourceFile:39) at MainApplication.onCreate(SourceFile:74) at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1119) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5740) at android.app.ActivityThread.-wrap1(Unknown Source:0) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1656) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6494) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807) Caused by: java.lang.ClassNotFoundException: Didn't find class "com.facebook.react.devsupport.DevSupportManagerImpl" on path: DexPathList[[zip file "/data/a at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:125) at java.lang.ClassLoader.loadClass(ClassLoader.java:379) at java.lang.ClassLoader.loadClass(ClassLoader.java:312)

Already have multidex enabled true for the application also okhttp client is excluded from flipper for api level 21

riskpp commented 2 years ago

Hi @Rohit-Surawat, Could you please check that you can't use just react-native plugin, without native sdk? As I mentioned above plugin has all features, which exist in native sdk.

Which react-native version is used in your project? could you please try to upgrade to latest supported by our plugin - 0.66.3

BR, Olga

Rohit-Surawat commented 2 years ago

Hi @riskpp , Thank you for swift response and paying attention to this issue.

Current React Native Version in our application : 0.65.1 Now after updating the Infobip version to 4.1.6 and adding few changes in proguard rules , Above crash (error) is gone but getting new error : Invariant Violation: “appName” has not been registered

But the app name returned by android native code and the name during app registry is same

agupta-avenir commented 2 years ago

@riskpp Any update on this issue. We are struggling to update the infobip version in our App from 2.2.0 -> 4.1.6 This is some more details of the error: ERROR Invariant Violation: "appName" has not been registered. This can happen if:

agupta-avenir commented 2 years ago

@riskpp Just an update we were successfully able to update to 4.0.0 but facing issue with v4.1.6 update

agupta-avenir commented 2 years ago

@kas-kad If you can throw some light on this issue as well will be great.

riskpp commented 2 years ago

Hi @agupta-avenir, sorry for delay in the answer Could you please send your proguard rules file, could be somehow related with the issue.. I've check for the following environment:

agupta-avenir commented 2 years ago

Here it is: proguard-rules.txt

riskpp commented 2 years ago

With provided proguard rules I also got error from this comment, but managed to solve it using this solution. Looks not related to mobile-messaging plugin.

For mobile-messaging plugin in pro-guard only this is needed:

# Application classes that will be serialized/deserialized over Gson
-keep class org.infobip.reactlibrary.mobilemessaging.Configuration* { *; }
-keep class org.infobip.reactlibrary.mobilemessaging.CacheManager* { *; }
agupta-avenir commented 2 years ago

I tried these steps but still the same. Issue is after upgrading to version 4.1.6 or 4.1.3 the react-native-config library is not loading up and thus App is not able to launch. Not sure what is causing this but only after updating infobip version we are getting this. We have updated till 4.0.0.

D/ReactNative: ReactConfig: Could not find BuildConfig class

riskpp commented 2 years ago

@agupta-avenir I see in provided proguard rules:

-keep class com.mypackage.BuildConfig { *; }

Do you have package named "com.mypackage"? It should be changed to your package name. "ReactConfig: Could not find BuildConfig class" issue could be related to this.

agupta-avenir commented 2 years ago

@riskpp Not sure if this is impacting but til version 4.0.0 its working with the same code base.

riskpp commented 2 years ago

Hi @agupta-avenir, could you please try to change in your proguard rules package name to real one? Would be great to have minimal example with which we can reproduce the issue, note that we already tried minimal react-native application with your environment and unfortunately can't reproduce the issue.

BR, Olga

agupta-avenir commented 2 years ago

@riskpp Finally able to fix the issue. Yes it was due to proguard config. Thanks a lot for help and support. We just got into another issue after updating the sdk where on iOS debugging has stopped working. Any help on that would be great.

riskpp commented 2 years ago

Hi @agupta-avenir , great that you managed to solve the initial problem! Could you please clarify, which debugging doesn't work on iOS? Do you mean flipper or debugging through xCode?

imkrishh commented 2 years ago

@riskpp with infobip 4.1.6 version the Initialize method (mobileMessaging.init) in iOS is crashing in chrome debug mode.

React Native Version 0.65.1 MobileMessaging Version 9.2.11 (was 9.1.10) infobip-mobile-messaging-react-native-plugin 4.1.6 (was 4.0.0)

Simulator Screen Shot infobip init crash

riskpp commented 2 years ago

Hi @imkrishh, we started working on it, will inform you about fix

riskpp commented 2 years ago

Should be fixed with new version - 5.0.1

riskpp commented 2 years ago

Was fixes in latest version