【问题标题】:I cannot view the map on my android using react-native maps我无法使用 react-native 地图在我的 android 上查看地图
【发布时间】: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"

然后错误消失了,但地图仍然没有加载到我的应用程序中 我该如何解决这个问题。

【问题讨论】:

标签: react-native react-native-maps


【解决方案1】:

我认为更改节点模块不是一个好主意。您可能应该使您的配置适应库,您可以粘贴您的 gradle conf 文件吗? android/build.gradle 和根目录。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2022-06-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-01-05
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多