Reputation: 286
I am unable to integrate react-natives-maps in a production build as I am unsure how to set it up with expo and react native 0.61.
Am I supposed to create a android/build.gradle file to make this work? Till now I wasn't needing this file as everything is handled by expo. I also don't have any other files in the android/ folder. This is the build.gradle that I have added:
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()
}
}
but I am actually unsure whether this file is used at all when I run expo build:android.
I have created the gradle file according to the installation instructions here, specifically for the 0.61 version.
When I open the APK-file after running expo build:android
the screen simply crashes which make me think somehow react-native-maps is not linked properly. I am not getting any error as the app simply restart.
Upvotes: 1
Views: 2164
Reputation: 28539
Depending on how you have created your react-native project with Expo will determine what folders are available and how you install dependencies.
By default Expo abstracts away the native iOS and Android code so that you do not have to worry about it.
As you project does not have and ios
and android
folders, this means that you are using a managed workflow which means you cannot install dependencies that add native code.
Expo provides MapView which is what you are looking for. You can install it by following the instructions here.
Basically, as you are using a managed workflow, you should use:
expo install react-native-maps
You shouldn't be adding ios
or android
folders to a managed workflow application as that won't do anything.
Upvotes: 1