【发布时间】:2018-05-08 07:23:49
【问题描述】:
我正在尝试使用 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."
然后我将node_modules/react-native-maps/lib/android/build.gradle中的代码更改如下
以前的代码
compileOnly() "com.facebook.react:react-native:+"
implementation" com.google.android.gms:play-services-
base:$googlePlayServicesVersion"
implementation" com.google.android.gms:play-services-
maps:$googlePlayServicesVersion"
implementation "com.google.maps.android:android-maps-
utils:$androidMapsUtilsVersion"
所做的更改
provided "com.facebook.react:react-native:+"
compile "com.google.android.gms:play-services-
base:$googlePlayServicesVersion"
compile "com.google.android.gms:play-services-
maps:$googlePlayServicesVersion"
compile "com.google.maps.android:android-maps-
utils:$androidMapsUtilsVersion"
然后错误消失了,但地图仍然没有加载到我的应用程序中 我该如何解决这个问题。
【问题讨论】:
-
您是否添加/编辑了此处给出的所有步骤:github.com/react-community/react-native-maps/blob/master/docs/…
-
是的,但地图在我的应用中不可见
-
我该如何解决这个问题
-
是不是必须要有gradle版本3
标签: react-native react-native-maps