Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not compatible with react-native-push-notification #831

Closed
pewh opened this issue Nov 26, 2016 · 15 comments
Closed

Not compatible with react-native-push-notification #831

pewh opened this issue Nov 26, 2016 · 15 comments

Comments

@pewh
Copy link

pewh commented Nov 26, 2016

Hi, my project is use react-native-push-notification and react-native-maps. Previously my project already configured to use react-native-push-notification, and it's work. But when I try insert react-native-maps, I got an error. I have guess something is wrong with my configuration. So I have do some experiment.

First, I fork your repo, and I can run your Example project in my android. But when I try to add react-native-push-notification on your Example project, I got same error.

D/dalvikvm( 8529): DexOpt: unable to opt direct call 0x8dfc at 0x7e in Lcom/airbnb/android/react/maps/AirMapManager;.receiveCommand
W/dalvikvm( 8529): Unable to resolve superclass of Lcom/google/android/gms/maps/model/LatLng; (4130)
W/dalvikvm( 8529): Link of class 'Lcom/google/android/gms/maps/model/LatLng;' failed
D/dalvikvm( 8529): DexOpt: unable to opt direct call 0x8def at 0xbc in Lcom/airbnb/android/react/maps/AirMapManager;.receiveCommand
W/dalvikvm( 8529): threadid=12: thread exiting with uncaught exception (group=0xa614d908)
E/AndroidRuntime( 8529): FATAL EXCEPTION: AsyncTask #2
E/AndroidRuntime( 8529): java.lang.RuntimeException: An error occured while executing doInBackground()
E/AndroidRuntime( 8529):        at android.os.AsyncTask$3.done(AsyncTask.java:299)
E/AndroidRuntime( 8529):        at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:352)
E/AndroidRuntime( 8529):        at java.util.concurrent.FutureTask.setException(FutureTask.java:219)
E/AndroidRuntime( 8529):        at java.util.concurrent.FutureTask.run(FutureTask.java:239)
E/AndroidRuntime( 8529):        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
E/AndroidRuntime( 8529):        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
E/AndroidRuntime( 8529):        at java.lang.Thread.run(Thread.java:856)
E/AndroidRuntime( 8529): Caused by: java.lang.NoClassDefFoundError: com.google.android.gms.maps.GoogleMapOptions
E/AndroidRuntime( 8529):        at com.airbnb.android.react.maps.AirMapManager.<init>(AirMapManager.java:53)
E/AndroidRuntime( 8529):        at com.airbnb.android.react.maps.MapsPackage.createViewManagers(MapsPackage.java:39)
E/AndroidRuntime( 8529):        at com.facebook.react.XReactInstanceManagerImpl.createAllViewManagers(XReactInstanceManagerImpl.java:699)
E/AndroidRuntime( 8529):        at com.facebook.react.CoreModulesPackage.createUIManager(CoreModulesPackage.java:204)
E/AndroidRuntime( 8529):        at com.facebook.react.CoreModulesPackage.access$200(CoreModulesPackage.java:69)
E/AndroidRuntime( 8529):        at com.facebook.react.CoreModulesPackage$8.get(CoreModulesPackage.java:143)
E/AndroidRuntime( 8529):        at com.facebook.react.CoreModulesPackage$8.get(CoreModulesPackage.java:140)
E/AndroidRuntime( 8529):        at com.facebook.react.LazyReactPackage.createNativeModules(LazyReactPackage.java:76)
E/AndroidRuntime( 8529):        at com.facebook.react.XReactInstanceManagerImpl.processPackage(XReactInstanceManagerImpl.java:954)
E/AndroidRuntime( 8529):        at com.facebook.react.XReactInstanceManagerImpl.createReactContext(XReactInstanceManagerImpl.java:862)
E/AndroidRuntime( 8529):        at com.facebook.react.XReactInstanceManagerImpl.access$600(XReactInstanceManagerImpl.java:110)
E/AndroidRuntime( 8529):        at com.facebook.react.XReactInstanceManagerImpl$ReactContextInitAsyncTask.doInBackground(XReactInstanceManagerImpl.ja
va:214)
E/AndroidRuntime( 8529):        at com.facebook.react.XReactInstanceManagerImpl$ReactContextInitAsyncTask.doInBackground(XReactInstanceManagerImpl.ja
va:193)
E/AndroidRuntime( 8529):        at android.os.AsyncTask$2.call(AsyncTask.java:287)

EDIT:
I also create fork for testing https://github.com/pewh/react-native-maps and let's see Example folder :)

@akshay2604
Copy link

akshay2604 commented Nov 29, 2016

I am facing the same issue. I have used react-native oneSignal instead. The app stops on real device in android without a stack trace. It works on ios simulator though. will try on ios device as well.
Edit: Working perfectly with ios:
"react-native-maps": "^0.10.4"
"react-native": "0.35.0",
Still crashing on android

@parkdcom
Copy link

parkdcom commented Dec 5, 2016

I have the same issue with onesignal and react-native-maps. It runs on iOS perfectly.

Edit: Ok after some analyzing, it seems it's a version mismatch of google play services between the two.

I edited node_modules/react-native-maps/android/build.gradle and changed the dependencies:

dependencies {
  compile 'com.facebook.react:react-native:+'
  compile "com.google.android.gms:play-services-base:+"
  compile 'com.google.android.gms:play-services-maps:+'
}

@pewh
Copy link
Author

pewh commented Dec 6, 2016

Thanks man. You save my life! 🍻

@kevinnguy
Copy link

@getconcar your suggestion fixed my issue #874 🙌

Do you have any idea why adding those dependencies fixed my issue?

@lucianomlima
Copy link

@getconcar suggestion works but I'm get another error when load a view with a MapView:

12-14 01:24:48.023 10569-10569/com.ibahia.carnaval24h E/unknown:React: Exception in native call
                                                                       java.lang.NullPointerException: Attempt to invoke virtual method 'void com.google.android.gms.maps.GoogleMap.animateCamera(com.google.android.gms.maps.CameraUpdate, int, com.google.android.gms.maps.GoogleMap$CancelableCallback)' on a null object reference
                                                                           at com.airbnb.android.react.maps.AirMapView.animateToRegion(AirMapView.java:483)
                                                                           at com.airbnb.android.react.maps.AirMapManager.receiveCommand(AirMapManager.java:209)
                                                                           at com.airbnb.android.react.maps.AirMapManager.receiveCommand(AirMapManager.java:29)
                                                                           at com.facebook.react.uimanager.NativeViewHierarchyManager.dispatchCommand(NativeViewHierarchyManager.java:703)
                                                                           at com.facebook.react.uimanager.UIViewOperationQueue$DispatchCommandOperation.execute(UIViewOperationQueue.java:257)
                                                                           at com.facebook.react.uimanager.UIViewOperationQueue$2.run(UIViewOperationQueue.java:782)
                                                                           at com.facebook.react.uimanager.UIViewOperationQueue.flushPendingBatches(UIViewOperationQueue.java:829)
                                                                           at com.facebook.react.uimanager.UIViewOperationQueue.access$1500(UIViewOperationQueue.java:44)
                                                                           at com.facebook.react.uimanager.UIViewOperationQueue$DispatchUIFrameCallback.doFrameGuarded(UIViewOperationQueue.java:868)
                                                                           at com.facebook.react.uimanager.GuardedChoreographerFrameCallback.doFrame(GuardedChoreographerFrameCallback.java:32)
                                                                           at com.facebook.react.uimanager.ReactChoreographer$ReactChoreographerDispatcher.doFrame(ReactChoreographer.java:131)
                                                                           at android.view.Choreographer$CallbackRecord.run(Choreographer.java:765)
                                                                           at android.view.Choreographer.doCallbacks(Choreographer.java:580)
                                                                           at android.view.Choreographer.doFrame(Choreographer.java:549)
                                                                           at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:753)
                                                                           at android.os.Handler.handleCallback(Handler.java:739)
                                                                           at android.os.Handler.dispatchMessage(Handler.java:95)
                                                                           at android.os.Looper.loop(Looper.java:135)
                                                                           at android.app.ActivityThread.main(ActivityThread.java:5343)
                                                                           at java.lang.reflect.Method.invoke(Native Method)
                                                                           at java.lang.reflect.Method.invoke(Method.java:372)
                                                                           at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:905)
                                                                           at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:700)

And if I try to reload app throws another error:

12-14 01:26:09.669 14784-14784/com.ibahia.carnaval24h E/unknown:React: Tried to remove non-existent frame callback
12-14 01:26:09.697 14784-14784/com.ibahia.carnaval24h E/AndroidRuntime: FATAL EXCEPTION: main
                                                                        Process: com.ibahia.carnaval24h, PID: 14784
                                                                        com.facebook.react.uimanager.IllegalViewOperationException: Trying to destroy unknown view tag: 86
                                                                         detail: View tag:84
                                                                          children(0): [
                                                                         ],
                                                                          indicesToRemove(1): [
                                                                        0,
                                                                         ],
                                                                          tagsToDelete(1): [
                                                                        86,
                                                                         ]
                                                                        
                                                                            at com.facebook.react.uimanager.NativeViewHierarchyManager.manageChildren(NativeViewHierarchyManager.java:406)
                                                                            at com.facebook.react.uimanager.UIViewOperationQueue$ManageChildrenOperation.execute(UIViewOperationQueue.java:175)
                                                                            at com.facebook.react.uimanager.UIViewOperationQueue$2.run(UIViewOperationQueue.java:782)
                                                                            at com.facebook.react.uimanager.UIViewOperationQueue.flushPendingBatches(UIViewOperationQueue.java:829)
                                                                            at com.facebook.react.uimanager.UIViewOperationQueue.pauseFrameCallback(UIViewOperationQueue.java:823)
                                                                            at com.facebook.react.uimanager.UIImplementation.onHostPause(UIImplementation.java:643)
                                                                            at com.facebook.react.uimanager.UIManagerModule.onHostPause(UIManagerModule.java:133)
                                                                            at com.facebook.react.bridge.ReactContext.onHostPause(ReactContext.java:229)
                                                                            at com.facebook.react.XReactInstanceManagerImpl.tearDownReactContext(XReactInstanceManagerImpl.java:827)
                                                                            at com.facebook.react.XReactInstanceManagerImpl.access$500(XReactInstanceManagerImpl.java:110)
                                                                            at com.facebook.react.XReactInstanceManagerImpl$ReactContextInitAsyncTask.onPreExecute(XReactInstanceManagerImpl.java:198)
                                                                            at android.os.AsyncTask.executeOnExecutor(AsyncTask.java:591)
                                                                            at com.facebook.react.XReactInstanceManagerImpl.recreateReactContextInBackground(XReactInstanceManagerImpl.java:755)
                                                                            at com.facebook.react.XReactInstanceManagerImpl.onJSBundleLoadedFromServer(XReactInstanceManagerImpl.java:738)
                                                                            at com.facebook.react.XReactInstanceManagerImpl.access$100(XReactInstanceManagerImpl.java:110)
                                                                            at com.facebook.react.XReactInstanceManagerImpl$1.onJSBundleLoadedFromServer(XReactInstanceManagerImpl.java:152)
                                                                            at com.facebook.react.devsupport.DevSupportManagerImpl$20$1.run(DevSupportManagerImpl.java:778)
                                                                            at android.os.Handler.handleCallback(Handler.java:739)
                                                                            at android.os.Handler.dispatchMessage(Handler.java:95)
                                                                            at android.os.Looper.loop(Looper.java:135)
                                                                            at android.app.ActivityThread.main(ActivityThread.java:5343)
                                                                            at java.lang.reflect.Method.invoke(Native Method)
                                                                            at java.lang.reflect.Method.invoke(Method.java:372)
                                                                            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:905)
                                                                            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:700)

Have 2 conflict packages: react-native-onesignal and react-native-admob.

@MobiusHorizons
Copy link

I just had this same issue last night after updating Android studio. Is there a way do fix this without editing code in node_modules?

@lucianomlima
Copy link

lucianomlima commented Feb 6, 2017

@MobiusHorizons in android/app/build.gradle try this:

    compile(project(':react-native-maps')) {
        exclude group: 'com.google.android.gms', module: 'play-services-base'
        exclude group: 'com.google.android.gms', module: 'play-services-maps'
    }

and below this

    compile 'com.google.android.gms:play-services-base:10.0.1'
    compile 'com.google.android.gms:play-services-maps:10.0.1'

@compojoom
Copy link
Contributor

@lucianomlima - thanks for this! But can you explain why we need this in the first place?
I don't know much about android development and I'm curious to find out what is going on here.

RN maps is coming with a build.gradle file and there we have this:

dependencies {
  compile "com.facebook.react:react-native:+"
  compile "com.google.android.gms:play-services-base:9.8.0"
  compile "com.google.android.gms:play-services-maps:9.8.0"
}

I checked on my machine and I do have 9.8.0, so I would think that the build process would take those? But i ran in in the

java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/maps/GoogleMapOptions;

error.
Changing my gradle to your version (but with 10.2.0 made it possible for the build to actually complete. Any ideas why this is going on? I used react-native link to link my depencies and I was hoping to have a more or less straightforward installation and not have to deal with the gradle file?

@lucianomlima
Copy link

@compojoom The problem is that other packages may compile other versions of Google Play Services.
Because this, they can not work properly.
When you delete google play services from the project build and add your own version for all packages, it ensures everyone will be using the same version.
Here I'm using 10.2.0 too.

@compojoom
Copy link
Contributor

@lucianomlima - aah, I see. I scanned my nodes_modules for com.google.android.gsm and found that react-native-device-info is adding

compile 'com.google.android.gms:play-servies-gcm:+' I don't know what the gcm is for , but the + should mean latest version. So most probably it includes 10.2.0 - RN maps is hardcoded to 9.8.0 and then we run into this issue. Wouldn't it be best if RN maps also compiles with + instead of hardcoded version?

@lucianomlima
Copy link

@compojoom GCM is Google Cloud Messaging, used for push notifications.
It is not a best practice to use the +, because if you have a break change in one of the gms modules it may be difficult to track down errors and fix them.

compojoom added a commit to compojoom/react-native-maps that referenced this issue Feb 28, 2017
Add troubleshooting information for common error with Google Play services error react-native-maps#831 (comment)
@compojoom
Copy link
Contributor

I added this info to the installation.md I hope that this make the installation a little easier on new users.

@linux08
Copy link

linux08 commented Oct 5, 2018

Issue still persist after trying the above .Here is my configuration
"react-native": "0.55.4", "react-native-maps": "^0.21.0", "react-native-push-notification": "^3.1.1"

@SarahYT
Copy link

SarahYT commented Oct 7, 2018

@linux08 same problem with maps and notifications, plz did you find any solution??

@linux08
Copy link

linux08 commented Oct 7, 2018

Hi @SarahYT Yea i was able to fix it,I created a repo containing how i integrated the packages. Check and see if it works for you
https://github.com/linux08/react-native-map-push-notification

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants