【发布时间】:2020-02-10 18:19:39
【问题描述】:
我无法将 react-natives-maps 集成到生产版本中,因为我不确定如何使用 expo 进行设置并响应原生 0.61。
我应该创建一个 android/build.gradle 文件来完成这项工作吗?到目前为止,我不需要这个文件,因为一切都由 expo 处理。我在 android/ 文件夹中也没有任何其他文件。这是我添加的 build.gradle:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.2'
classpath 'de.undercouch:gradle-download-task:4.0.0'
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'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
但我实际上不确定当我运行 expo build:android 时是否使用了这个文件。
我已经按照安装说明here创建了gradle文件,专门针对0.61版本的。
当我在运行expo build:android 后打开 APK 文件时,屏幕只是崩溃了,这让我觉得 react-native-maps 没有正确链接。我没有收到任何错误,因为应用程序只是重新启动。
【问题讨论】:
-
如果您使用的是 expo,那么您应该按照here 的说明安装地图。 expo 应用程序没有 android 或 ios 文件夹,添加它们不会得到任何东西。
-
谢谢@Andrew,由于某种原因我错过了。我按照说明进行操作,现在可以正常工作。如果您将您的评论作为答案,我将接受它作为答案。
标签: react-native react-native-android react-native-maps