React Native Maps

0

I'm trying to implement the React-native-maps library in my project, when I run react-native run-android I get this error in CMD:

* Where:
Build file 'C:\Users\Henrique\Documents\New folder\NoExpo\AwesomeProject\node_modules\react-native-maps\lib\android\build.gradle' line: 46

* What went wrong:
A problem occurred evaluating project ':react-native-maps'.
> Could not find method compileOnly() for arguments [com.facebook.react:react-native:+] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

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

BUILD FAILED

Total time: 7.449 secs
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/getting-started.html

I configured the build.gradle file like this:

dependencies {
    compile project(':react-native-maps')
    compile fileTree(dir: "libs", include: ["*.jar"])
    compile "com.android.support:appcompat-v7:23.0.1"
    compile "com.facebook.react:react-native:+"  // From node_modules
}
    
asked by anonymous 06.05.2018 / 23:36

1 answer

1

If you do not have defined properties for the entire project defined and you have a different version of the services included in this library, use the following (switch 10.0.1 to the desired version):

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

In your android / settings.gradle:

include ':react-native-maps' project(':react-native-maps').projectDir = new File(rootProject.projectDir,'../node_modules/react-native-maps/lib/android')

    
05.09.2018 / 14:07