react-native-maps: Android app crashes after adding the react-native-maps dependency

#2880 Bug

We have created a demo app with react-native-maps dependency. The project is a simple one and doesn’t really render a map, but we have noticed that just after adding the dependancy the app started crashing in Android platform.

Here is a video reference of what is going on:

https://drive.google.com/open?id=11eZIEMjMEoOgQViVRS_JhTqHWu-Lnytk

Environment info

React native info output:

 React Native Environment Info:
    System:
      OS: macOS 10.14.3
      CPU: (8) x64 Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz
      Memory: 5.60 GB / 16.00 GB
      Shell: 5.3 - /bin/zsh
    Binaries:
      Node: 10.8.0 - /usr/local/bin/node
      Yarn: 1.15.2 - /usr/local/bin/yarn
      npm: 6.2.0 - /usr/local/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    SDKs:
      iOS SDK:
        Platforms: iOS 12.2, macOS 10.14, tvOS 12.2, watchOS 5.2
      Android SDK:
        API Levels: 22, 23, 25, 26, 27, 28
        Build Tools: 23.0.1, 23.0.2, 25.0.0, 25.0.2, 25.0.3, 26.0.1, 26.0.2, 26.0.3, 27.0.0, 27.0.1, 27.0.3, 28.0.2, 28.0.3, 29.0.0, 29.0.0
        System Images: android-19 | Google APIs Intel x86 Atom, android-21 | Intel x86 Atom, android-22 | Google APIs Intel x86 Atom, android-23 | Google APIs Intel x86 Atom, android-26 | Google APIs Intel x86 Atom, android-27 | Google APIs Intel x86 Atom, android-P | Google Play Intel x86 Atom, android-Q | Google Play Intel x86 Atom, android-Q | Google Play Intel x86 Atom_64
    IDEs:
      Android Studio: 3.4 AI-183.6156.11.34.5522156
      Xcode: 10.2.1/10E1001 - /usr/bin/xcodebuild
    npmPackages:
      react: 16.8.3 => 16.8.3 
      react-native: 0.59.8 => 0.59.8 
    npmGlobalPackages:
      react-native-cli: 2.0.1

Library version: ^0.24.2

Steps To Reproduce

 Run it first time it’ll work.

`yarn add react-native-maps`
`react-native link`

Delete the app

Run it again

Broken

Describe what you expected to happen:

  1. The app should not crash on launch

  2. After giving the location permission the app should not crash

Reproducible sample code

Here is the full project code:

https://bitbucket.org/abhideep_appdukan/locationtest/src/master/

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 20

Most upvoted comments

You can look at abd logcat to see the native crash report as you open the app. That could help us figure out what the issue is. However, I was also recently getting a lot of crashes for devices on the latest version of Android and Crashlytics reported this crash:

Fatal Exception: java.lang.NoClassDefFoundError
Failed resolution of: Lorg/apache/http/ProtocolVersion;

This is an issue with the underlying maps library. Also see this official documentation from Google.

The solution: put this in the Manifest <application> tag:

<uses-library android:name="org.apache.http.legacy" android:required="false"/>

It might not be your issue, but it would be easy to try 😃

This issue is fixed in the latest update of react-native-maps.

The solution: put this in the Manifest <application> tag:

<uses-library android:name="org.apache.http.legacy" android:required="false"/>

It might not be your issue, but it would be easy to try 😃

Worked perfectly 👍

Hi my apk keeps crashing when i am trying to navigate to the screen that uses react-native-maps. What should i do?

Having this issue in a managed Expo App, maps version 0.26.1 and I can’t modify my manifest…

Kindly follow the configurations steps mentioned in the below link https://docs.expo.dev/versions/latest/sdk/map-view/

I having issue with latest version. I tried above solution but it is still crashing.

Its working now. I just clean gradlew and it works now.

you should not run react-native link by itself, you need to use it with the package you want to link react-native link react-native-maps