react-native-google-place-picker icon indicating copy to clipboard operation
react-native-google-place-picker copied to clipboard

Conflicting 'com.google.android.gms:play-services-location:' with react-native maps

Open chetnadaffodil opened this issue 8 years ago • 4 comments

Hi, I am trying to use your package along with react-native-maps but the creation of the build is failing due to conflicting 'com.google.android.gms:play-services-location' in both packages.

Here is a picture of the error thrown screenshot from 2016-12-12 13-34-29

chetnadaffodil avatar Dec 12 '16 08:12 chetnadaffodil

Your build.gradle file

dependencies { compile 'com.facebook.react:react-native:+' compile 'com.google.android.gms:play-services-location:8.4.0' }

React Native Maps build.gradle file dependencies { compile 'com.facebook.react:react-native:+' compile "com.google.android.gms:play-services-base:9.4.0" compile 'com.google.android.gms:play-services-maps:9.4.0' }

There is a mismatch of the versions for com.google.android.gms package Please upgrade it to 9.4.0

chetnadaffodil avatar Dec 12 '16 09:12 chetnadaffodil

@chetnadaffodil I've updated com.google.android.gms to 9.4.0 and added compile 'com.google.android.gms:play-services-places:9.4.0' but it seems somethins still off. There is no conflict anymore but got fallowing error:

image

whole crash log:

297/com.awesomeproject E/unknown:React: Exception in native call
                                                                 java.lang.RuntimeException: Could not invoke RNGooglePlacePicker.show
                                                                     at com.facebook.react.bridge.BaseJavaModule$JavaMethod.invoke(BaseJavaModule.java:332)
                                                                     at com.facebook.react.cxxbridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:158)
                                                                     at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
                                                                     at android.os.Handler.handleCallback(Handler.java:751)
                                                                     at android.os.Handler.dispatchMessage(Handler.java:95)
                                                                     at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:31)
                                                                     at android.os.Looper.loop(Looper.java:154)
                                                                     at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:196)
                                                                     at java.lang.Thread.run(Thread.java:761)
                                                                  Caused by: java.lang.reflect.InvocationTargetException
                                                                     at java.lang.reflect.Method.invoke(Native Method)
                                                                     at com.facebook.react.bridge.BaseJavaModule$JavaMethod.invoke(BaseJavaModule.java:318)
                                                                     at com.facebook.react.cxxbridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:158) 
                                                                     at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method) 
                                                                     at android.os.Handler.handleCallback(Handler.java:751) 
                                                                     at android.os.Handler.dispatchMessage(Handler.java:95) 
                                                                     at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:31) 
                                                                     at android.os.Looper.loop(Looper.java:154) 
                                                                     at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:196) 
                                                                     at java.lang.Thread.run(Thread.java:761) 
                                                                  Caused by: java.lang.NoSuchMethodError: No virtual method zzbo(Landroid/content/Context;)V in class Lcom/google/android/gms/common/GoogleApiAvailability; or its super classes (declaration of 'com.google.android.gms.common.GoogleApiAvailability' appears in /data/app/com.awesomeproject-2/base.apk)
                                                                     at com.google.android.gms.location.places.ui.zza$zza.build(Unknown Source)
                                                                     at com.google.android.gms.location.places.ui.PlacePicker$IntentBuilder.build(Unknown Source)
                                                                     at com.reactlibrary.RNGooglePlacePickerModule.show(RNGooglePlacePickerModule.java:55)
                                                                     at java.lang.reflect.Method.invoke(Native Method) 
                                                                     at com.facebook.react.bridge.BaseJavaModule$JavaMethod.invoke(BaseJavaModule.java:318) 
                                                                     at com.facebook.react.cxxbridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:158) 
                                                                     at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method) 
                                                                     at android.os.Handler.handleCallback(Handler.java:751) 
                                                                     at android.os.Handler.dispatchMessage(Handler.java:95) 
                                                                     at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:31) 
                                                                     at android.os.Looper.loop(Looper.java:154) 
                                                                     at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:196) 
                                                                     at java.lang.Thread.run(Thread.java:761) 

KamWis avatar Dec 28 '16 19:12 KamWis

@KamWis @chetnadaffodil Looks like the play services places library has been moved since the 8.4.0 version referenced in react-native-google-place-picker.

I was able to workaround by forking and updating react-native-google-place-picker's dependency.

See my forked change: https://github.com/geordasche/react-native-google-place-picker/commit/85abf5cd2efceb64e414dda59872d90ad5c4f89b

try npm install github:geordasche/react-native-google-place-picker to see if that works for you.

Hope this helps. Remember to reset your npm cache and clean/sync your build as well.

geordasche avatar Jan 06 '17 05:01 geordasche

Closed and reopened this issue as it's impossible keep dependencies always be compatible with other libraries. If there is conflict, please refer to @chetnadaffodil or @geordasche 's comment, modify the build.gradle from either side manually to resolve it.

zhangtaii avatar Jan 06 '17 07:01 zhangtaii