Maps: [BUG]Offline pack manager crash on Android

Created on 4 Apr 2020  路  7Comments  路  Source: react-native-mapbox-gl/maps

Describe the bug
Putting Offlinemanager's getPacks into code leads to crash of App

To Reproduce
1)react-native init AwesomeProject
2)follow installation guide of mapbox
3) Put some sample code with mapbox(example in getting started)
4)use MapboxGL.offlineManager.getPacks()
5)npx react-native run-android

Example:
from getting started page + some usage of getPacks in componentDidMount

import React, { Component } from "react";
import { StyleSheet, View } from "react-native";
import MapboxGL from "@react-native-mapbox-gl/maps";

MapboxGL.setAccessToken("<YOUR_ACCESSTOKEN>");
const styles = StyleSheet.create({
  page: {
    flex: 1,
    justifyContent: "center",
    alignItems: "center",
    backgroundColor: "#F5FCFF"
  },
  container: {
    height: 300,
    width: 300,
    backgroundColor: "tomato"
  },
  map: {
    flex: 1
  }
});

export default class App extends Component {
  componentDidMount() {
    MapboxGL.setTelemetryEnabled(false);
    MapboxGL.offlineManager.getPacks().then(res => (console.log(res)));
  }

  render() {
    return (
      <View style={styles.page}>
        <View style={styles.container}>
          <MapboxGL.MapView style={styles.map} />
        </View>
      </View>
    );
  }
}

Expected behavior
App works fine and logging all available offline packs

Versions:

  • Platform: Android
  • Emulator/ Simulator: no
  • OS: Android 10
  • react-native-mapbox-gl Version 8.0.0
  • React Native Version 0.60.5, 0.62.2

Screenshot:

Feedback

Android wontfix

Most helpful comment

We ran into the same issue.

Here is the crashing stack trace.
Screen Shot 2020-04-24 at 8 51 57 AM

It appears that the issue is called by calling getPack before the map has loaded. Try

```
render() {
return (
style={styles.map}
onDidFinishLoadingMap={() => {
MapboxGL.setTelemetryEnabled(false);
MapboxGL.offlineManager.getPacks().then(res => (console.log(res)));
}}
/>


);
}

All 7 comments

Funny note: If add code with getPacks() after run-android(so by refreshing apps) nothing crash, and getPacks works well

@zanaviska what was the exact crash?!

@mfazekas suddenly stop working. Uploaded post with gif of execution of example code

We ran into the same issue.

Here is the crashing stack trace.
Screen Shot 2020-04-24 at 8 51 57 AM

It appears that the issue is called by calling getPack before the map has loaded. Try

```
render() {
return (
style={styles.map}
onDidFinishLoadingMap={() => {
MapboxGL.setTelemetryEnabled(false);
MapboxGL.offlineManager.getPacks().then(res => (console.log(res)));
}}
/>


);
}

I have the same issue. After a while of investigation, I found out that one of the returned pack is completely invalid. It has invalid bounding box ([18, 112], [-18, -112]). When I omit it stops crashing. I hope it can help somebody.

We ran into the same issue.

Here is the crashing stack trace.
Screen Shot 2020-04-24 at 8 51 57 AM

It appears that the issue is called by calling getPack before the map has loaded. Try

  render() {
    return (
      <View style={styles.page}>
        <View style={styles.container}>
          <MapboxGL.MapView
            style={styles.map}
            onDidFinishLoadingMap={() => {
              MapboxGL.setTelemetryEnabled(false);
              MapboxGL.offlineManager.getPacks().then(res => (console.log(res)));
            }}
          />
        </View>
      </View>
    );
  }

Hey bro, work for me, thanks..

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

fvieira picture fvieira  路  4Comments

arnaudambro picture arnaudambro  路  5Comments

mustafaskyer picture mustafaskyer  路  3Comments

jayhaluska picture jayhaluska  路  5Comments

magnusburton picture magnusburton  路  3Comments