简体   繁体   中英

Error while installing and implementing react native device info

I am trying to integrate react-native-device-info to my project and when I install the module and link it an error comes up like this

```

* What went wrong:
Execution failed for task ':app:preDebugBuild'.
> Android dependency 'com.google.android.gms:play-services-base' has different version for the compile (15.0.1) and runtime (16.0.1) classpath. You should manually set the same version via DependencyResolution

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 6s
13 actionable tasks: 1 executed, 12 up-to-date

```

And when I configure the project manually same error comes up.But when I unlink react native device info, the project runs well.

Add this block in your app/build.gradle file below buildTypes{} block and run the app again

configurations.all {
    resolutionStrategy {
           force 'com.google.android.gms:play-services-base:16.0.1'
    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM