I'm trying to run my react native app with react-native-maps . 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:
error: package com.airbnb.android.react.maps does not exist
How do I get that package into the android build of my react-native app?
android/settings.gradle
has mappings from the projects/packages to their respective folder in node_modules
.
In the react-native-maps docs it says this should be in 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. So I changed it to this (add "lib" before "android"):
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.