Code Monkey home page Code Monkey logo

Comments (11)

inkwaris avatar inkwaris commented on May 14, 2024 22

this work for me

  1. in root "build.gradle" add below code

ext {
googlePlayServicesVersion = "11.0.0"
}

  1. in "app/build.gradle"

dependencies {
...
implementation "com.google.android.gms:play-services-location:16.0.0" // <-- add this line
}

from react-native-geolocation-service.

dmitrizagidulin avatar dmitrizagidulin commented on May 14, 2024 2

This issue was very helpful. I ended up having to combine the solutions from two different comments above, in order to make it work. So, in case anybody (or future me) finds it useful:

Do both:

In top-level build.gradle, define googlePlayServicesVersion and add the resolution strategy:

def googlePlayServicesVersion = '16.0.0'

allprojects {
    repositories {
        mavenLocal()
        jcenter()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url "$rootDir/../node_modules/react-native/android"
        }
        configurations.all {
            resolutionStrategy {
                force "com.google.android.gms:play-services-ads:$googlePlayServicesVersion"
                force "com.google.android.gms:play-services-location:$googlePlayServicesVersion"
            }
        }
        google()
    }
}

And ALSO, in app/build.gradle, add this line to the dependencies:

implementation "com.google.android.gms:play-services-location:16.0.0"

from react-native-geolocation-service.

Agontuk avatar Agontuk commented on May 14, 2024 1

You are using libraries that depend on some google play service modules, and each library is using different versions of google play service. You have to make sure all libraries use the same version, even if they're using different modules. You can check the dependencies by using the cd android && ./gradlew app:dependencies command.

from react-native-geolocation-service.

oakis avatar oakis commented on May 14, 2024 1

The solution for me was to remove googlePlayServicesVersion=12.0.1 in android/gradle.properties. It was lingering there from an older version of react-native-geolocation-service.

from react-native-geolocation-service.

sinoridha avatar sinoridha commented on May 14, 2024 1

use resolution strategy


 def googlePlayServicesVersion = '11.0.+'
 
 allprojects {
     repositories {
         mavenLocal()
         jcenter()
         maven {
             url "$rootDir/../node_modules/react-native/android"
         }
         configurations.all {
             resolutionStrategy {
                 force "com.google.android.gms:play-services-ads:$googlePlayServicesVersion"
                 force "com.google.android.gms:play-services-location:$googlePlayServicesVersion" //add this!
             }
         }
     }
 }

from react-native-geolocation-service.

Agontuk avatar Agontuk commented on May 14, 2024 1

You should always use a single version for all of your google play service modules (location, geocode, places etc.). Most of the libraries support project wide gradle configuration. So you should define the version you want to use in root build.gradle file. If a library does not support project wide gradle config, you have to override that libraries GPS dependency in your app/build.gradle file.

root build.gradle
ext {
    googlePlayServicesVersion = "12.0.0"
}
app/build.gradle (if you need to override manually)
compile(project(':react-native-package-name')) {
    exclude group: 'com.google.android.gms', module: 'module-name'
}
compile 'com.google.android.gms:module-name:12.0.0'

It's also documented in README.

from react-native-geolocation-service.

abadooz avatar abadooz commented on May 14, 2024

I solved this problem. It just need add below code to root build.gradle

ext {
googlePlayServicesVersion = "11.0.0"
}

from react-native-geolocation-service.

Kamill90 avatar Kamill90 commented on May 14, 2024

Unfortunately it doesn't work for me

from react-native-geolocation-service.

darknblack avatar darknblack commented on May 14, 2024

implementation "com.google.android.gms:play-services-location:16.0.0" // <-- add this line

Thanks it worked

from react-native-geolocation-service.

francois-pasquier avatar francois-pasquier commented on May 14, 2024

inkwaris's solutions worked for me (fresh react native project: 0.59.3)

from react-native-geolocation-service.

faizaanshah avatar faizaanshah commented on May 14, 2024

Same issue nothing worked (react-native 0.59.3)

from react-native-geolocation-service.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.