question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG]Offline pack manager crash on Android

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
L-Yeisercommented, Apr 24, 2020

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>
    );
  }
1reaction
zanaviskacommented, Apr 4, 2020

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

[BUG]Offline pack manager crash on Android #773 - GitHub
Describe the bug. Putting Offlinemanager's getPacks into code leads to crash of App. To Reproduce 1)react-native init AwesomeProject
Read more >
Android: apps crashes every time i try to open file manager
Hello all, I have a very big problem: If I open an app that needs to interact with my file manager, when I...
Read more >
Detect and diagnose crashes - Android Developers
An Android app crashes whenever there's an unexpected exit caused by an unhandled exception or signal. An app that is written using Java...
Read more >
Android packagemanager list causing app to crash
I downloaded Android Studio today and started a new project. I added an empty activity to the form with a textview with the...
Read more >
11 Quick Ways to Fix Apps Keep Crashing on Android - iMobie
Go to Settings > “Apps” or “Application manager” > Choose the app that crashes > Tap the “Uninstall” option to make it. Then...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found