简体   繁体   English

反应本机地图-Android上的白色地图问题

[英]react native maps - white map issue on android

I'm trying to run my react native app with react-native-maps . 我正在尝试使用react-native-maps运行我的react native应用程序。 I am getting the white map with red border issue. 我得到带有红色边框问题的白色地图。 I am sure the answer to that for me is the bottom comment here . 我敢肯定,对我来说,答案是这里的最坏评论。 But when I implement it in code in xxx/android/app/src/main/java/com/xxx/MainApplication.java, I just get this error: 但是当我在xxx / android / app / src / main / java / com / xxx / MainApplication.java中的代码中实现它时,我只会收到此错误:

error: package com.airbnb.android.react.maps does not exist 错误:包com.airbnb.android.react.maps不存在

How do I get that package into the android build of my react-native app? 如何将该软件包放入我的react-native应用程序的android版本中?

android/settings.gradle has mappings from the projects/packages to their respective folder in node_modules . android/settings.gradle具有从project / packages到node_modules相应文件夹的node_modules

In the react-native-maps docs it says this should be in android/settings.gradle: 在react-native-maps文档中,它说这应该在android / settings.gradle中:

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

However, observing my node_modules/react-native-maps folder, I saw that the path to the android folder was different than above, and had lib, then android. 但是,观察我的node_modules/react-native-maps文件夹,我发现android文件夹的路径不同于上面的路径,并且具有lib和android。 So I changed it to this (add "lib" before "android"): 所以我将其更改为此(在“ android”之前添加“ lib”):

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

Then cleaned and rebuilt the project in android studio, then it worked. 然后在android studio中清理并重建项目,然后工作了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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