Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

JNI Error weak global reference table overflow when animating #11556

Closed
mbrame12 opened this issue Mar 29, 2018 · 7 comments
Closed

JNI Error weak global reference table overflow when animating #11556

mbrame12 opened this issue Mar 29, 2018 · 7 comments
Labels
Android Mapbox Maps SDK for Android

Comments

@mbrame12
Copy link

I'm using a slightly modified version of https://github.com/mapbox/mapbox-gl-native/blob/dfb9b26e675a152a925fcc5b84c3e14b8b9779d2/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/AnimatedSymbolLayerActivity.java#L265-L278 on a Huawei BTV-W09. The main modification is that in the addRandomCars() method, I add 150 cars instead of 10.

Background

In our app, we're currently using version 4.1.1 of the Mapbox SDK. We want to upgrade to a more recent version, but need to switch away from using MarkerView if we do so. We have modified code that is doing much of what we want with 5.5.1 and 6.0.0-beta.5 in terms of drawing moving items on the map using SymbolLayer. However, since it crashes, we can't use either of these releases unless there is something else that we can do to avoid this problem.

Platform: Android
Mapbox SDK version: 5.5.1, 6.0.0-beta.5 (both were tested)

Steps to trigger behavior

  1. Open the app
  2. Observe it crash after several minutes

Expected behavior

The app continues to run until stopped, and the symbols keep moving and rotating.

Actual behavior

The app crashes after a few minutes, with the following error:

03-29 11:22:01.809 11482-11531/com.mapboxtest A/art: art/runtime/indirect_reference_table.cc:125] JNI ERROR (app bug): weak global reference table overflow (max=51200)
    art/runtime/indirect_reference_table.cc:125] weak global reference table dump:
    art/runtime/indirect_reference_table.cc:125]   Last 10 entries (of 51200):
    art/runtime/indirect_reference_table.cc:125]     51199: 0x12ec0520 java.lang.Thread
    art/runtime/indirect_reference_table.cc:125]     51198: 0x12ec04c0 java.lang.Thread
    art/runtime/indirect_reference_table.cc:125]     51197: 0x12ec0460 java.lang.Thread
    art/runtime/indirect_reference_table.cc:125]     51196: 0x12ec0400 java.lang.Thread
    art/runtime/indirect_reference_table.cc:125]     51195: 0x12ec03a0 java.lang.Thread
    art/runtime/indirect_reference_table.cc:125]     51194: 0x12ec0340 java.lang.Thread
    art/runtime/indirect_reference_table.cc:125]     51193: 0x12ec02e0 java.lang.Thread
    art/runtime/indirect_reference_table.cc:125]     51192: 0x12ec0280 java.lang.Thread
    art/runtime/indirect_reference_table.cc:125]     51191: 0x12ec0220 java.lang.Thread
    art/runtime/indirect_reference_table.cc:125]     51190: 0x12ec01c0 java.lang.Thread
    art/runtime/indirect_reference_table.cc:125]   Summary:
    art/runtime/indirect_reference_table.cc:125]         1 of com.mapbox.mapboxsdk.maps.NativeMapView
    art/runtime/indirect_reference_table.cc:125]         1 of android.opengl.GLSurfaceView$GLThread
    art/runtime/indirect_reference_table.cc:125]         1 of com.mapbox.mapboxsdk.maps.MapView$5
    art/runtime/indirect_reference_table.cc:125]      4961 of java.lang.Class (4961 unique instances)
    art/runtime/indirect_reference_table.cc:125]         1 of java.lang.ThreadGroup
    art/runtime/indirect_reference_table.cc:125]         1 of byte[] (1 elements)
    art/runtime/indirect_reference_table.cc:125]         2 of byte[] (16 elements) (2 unique instances)
    art/runtime/indirect_reference_table.cc:125]         2 of byte[] (100 elements) (2 unique instances)
    art/runtime/indirect_reference_table.cc:125]         3 of byte[] (288 elements) (3 unique instances)
    art/runtime/indirect_reference_table.cc:125]         3 of byte[] (576 elements) (3 unique instances)
    art/runtime/indirect_reference_table.cc:125]         4 of byte[] (840 elements) (4 unique instances)
    art/runtime/indirect_reference_table.cc:125]         6 of byte[] (1248 elements) (6 unique instances)
    art/runtime/indirect_reference_table.cc:125]         5 of byte[] (1296 elements) (5 unique instances)
    art/runtime/indirect_reference_table.cc:125]         3 of byte[] (1440 elements) (3 unique instances)
    art/runtime/indirect_reference_table.cc:125]         8 of byte[] (1560 elements) (8 unique instances)
    art/runtime/indirect_reference_table.cc:125]         4 of byte[] (2304 elements) (4 unique instances)
    art/runtime/indirect_reference_table.cc:125]         2 of byte[] (3600 elements) (2 unique instances)
    art/runtime/indirect_reference_table.cc:125]         4 of byte[] (4320 elements) (4 unique instances)
    art/runtime/indirect_reference_table.cc:125]         3 of byte[] (5016 elements) (3 unique instances)
    art/runtime/indirect_reference_table.cc:125]         3 of byte[] (6912 elements) (3 unique instances)
    art/runtime/indirect_reference_table.cc:125]         8 of byte[] (9216 elements) (8 unique instances)
    art/runtime/indirect_reference_table.cc:125]         2 of byte[] (12672 elements) (2 unique instances)
    art/runtime/indirect_reference_table.cc:125]         1 of byte[] (15876 elements)
    art/runtime/indirect_reference_table.cc:125]         1 of byte[] (17280 elements)
    art/runtime/indirect_reference_table.cc:125]        29 of byte[] (20736 elements) (29 unique instances)
    art/runtime/indirect_reference_table.cc:125]         2 of byte[] (21168 elements) (2 unique instances)
    art/runtime/indirect_reference_table.cc:125]        16 of byte[] (25344 elements) (16 unique instances)
    art/runtime/indirect_reference_table.cc:125]        27 of byte[] (26244 elements) (27 unique instances)
    art/runtime/indirect_reference_table.cc:125]        50 of byte[] (29952 elements) (50 unique instances)
    art/runtime/indirect_reference_table.cc:125]         1 of byte[] (32256 elements)
    art/runtime/indirect_reference_table.cc:125]         1 of byte[] (32448 elements)
    art/runtime/indirect_reference_table.cc:125]         2 of byte[] (34848 elements) (2 unique instances)
    art/runtime/indirect_reference_table.cc:125]         6 of byte[] (35344 elements) (6 unique instances)
    art/runtime/indirect_reference_table.cc:125]       128 of byte[] (36864 elements) (128 unique instances)
    art/runtime/indirect_reference_table.cc:125]         3 of byte[] (46656 elements) (3 unique instances)
    art/runtime/indirect_reference_table.cc:125]         4 of byte[] (55296 elements) (4 unique instances)
    art/runtime/indirect_reference_table.cc:125]         2 of byte[] (58320 elements) (2 unique instances)
    art/runtime/indirect_reference_table.cc:125]         1 of byte[] (64260 elements)
    art/runtime/indirect_reference_table.cc:125]         4 of byte[] (73728 elements) (4 unique instances)
    art/runtime/indirect_reference_table.cc:125]         4 of byte[] (76032 elements) (4 unique instances)
    art/runtime/indirect_reference_table.cc:125]         1 of byte[] (82368 elements)
    art/runtime/indirect_reference_table.cc:125]         6 of byte[] (82944 elements) (6 unique instances)
    art/runtime/indirect_reference_table.cc:125]         1 of byte[] (85264 elements)
    art/runtime/indirect_reference_table.cc:125]         2 of byte[] (98136 elements) (2 unique instances)
    art/runtime/indirect_reference_table.cc:125]        10 of byte[] (140160 elements) (10 unique instances)
    art/runtime/indirect_reference_table.cc:125]         2 of byte[] (147456 elements) (2 unique instances)
    art/runtime/indirect_reference_table.cc:125]         2 of byte[] (207936 elements) (2 unique instances)
    art/runtime/indirect_reference_table.cc:125]         8 of byte[] (349056 elements) (8 unique instances)
    art/runtime/indirect_reference_table.cc:125]       229 of java.lang.Thread (229 unique instances)
    art/runtime/indirect_reference_table.cc:125] 
    art/runtime/runtime.cc:368] Runtime aborting...
    art/runtime/runtime.cc:368] 
03-29 11:22:01.810 11482-11531/com.mapboxtest A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 11531 (Thread-50561)
@LukasPaczos
Copy link
Contributor

Thanks for the report. Closing as a duplicate, please follow #11212.

@LukasPaczos LukasPaczos added the Android Mapbox Maps SDK for Android label Mar 30, 2018
@ivovandongen
Copy link
Contributor

Tried to reproduce this with the steps in the OP (increasing to 3000 cars), but don't see the same issue. Tested on a Pixel 2 and Galaxy Nexus.

ivovandongen added a commit that referenced this issue Apr 4, 2018
@mbrame12
Copy link
Author

mbrame12 commented Apr 4, 2018

I should have mentioned that I was using our own large icons (200x250) in this example. I saw the same crash in our main app, but have not seen the crash in our main app after removing animations and adding logic to scale the icons down to the proper size. Maybe the size of the icons leads to this problem.

@ivovandongen
Copy link
Contributor

@mbrame12 Good to hear you found a work around for now at least

I should have mentioned that I was using our own large icons (200x250) in this example

Thanks for the additional note. Tried to scale up the large icons, but this doesn't affect the weak global reference table at all on my side. A typical dump looks like the following (and doesn't change during a run):

weak global reference table dump:
  Last 10 entries (of 27):
       26: 0x132403c8 java.lang.Thread
       25: 0x130000a8 com.mapbox.mapboxsdk.maps.NativeMapView
       24: 0x13001b20 com.mapbox.mapboxsdk.maps.MapView$5
       23: 0x13001f80 android.opengl.GLSurfaceView
       22: 0x132439c8 dalvik.system.PathClassLoader
       21: 0x13244c38 java.lang.DexCache
       20: 0x132439c8 dalvik.system.PathClassLoader
       19: 0x132439c8 dalvik.system.PathClassLoader
       18: 0x70c48da0 java.lang.BootClassLoader
       17: 0x733cba98 dalvik.system.PathClassLoader
  Summary:
       18 of java.lang.DexCache (18 unique instances)
        4 of dalvik.system.PathClassLoader (2 unique instances)
        1 of android.opengl.GLSurfaceView
        1 of com.mapbox.mapboxsdk.maps.MapView$5
        1 of com.mapbox.mapboxsdk.maps.NativeMapView
        1 of java.lang.Thread
        1 of java.lang.BootClassLoader

Do you use any other libraries with a native component? Does this occur on any other device than the Huawei BTV-W09 for you? If you could share a concrete example, this would be great.

@LukasPaczos
Copy link
Contributor

Per chat, this issue probably has a different origin than #11212, therefore reopening.

@LukasPaczos LukasPaczos reopened this Apr 5, 2018
@mbrame12
Copy link
Author

mbrame12 commented Apr 5, 2018

Here is the code that I'm using:


import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.TypeEvaluator;
import android.animation.ValueAnimator;
import android.graphics.drawable.BitmapDrawable;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.view.animation.LinearInterpolator;

import com.google.gson.JsonObject;
import com.mapbox.geojson.Feature;
import com.mapbox.geojson.FeatureCollection;
import com.mapbox.geojson.Geometry;
import com.mapbox.geojson.Point;
import com.mapbox.mapboxsdk.Mapbox;
import com.mapbox.mapboxsdk.geometry.LatLng;
import com.mapbox.mapboxsdk.geometry.LatLngBounds;
import com.mapbox.mapboxsdk.maps.MapView;
import com.mapbox.mapboxsdk.maps.MapboxMap;
import com.mapbox.mapboxsdk.maps.OnMapReadyCallback;
import com.mapbox.mapboxsdk.style.expressions.Expression;
import com.mapbox.mapboxsdk.style.layers.PropertyFactory;
import com.mapbox.mapboxsdk.style.layers.SymbolLayer;
import com.mapbox.mapboxsdk.style.sources.GeoJsonSource;
import com.saab.acdm.acdm.R;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;

import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.iconAllowOverlap;
import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.iconIgnorePlacement;
import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.iconImage;


/**
 * A login screen that offers login via username/password.
 */
public class AnimatedSymbolLayerActivity extends AppCompatActivity {
    private static final String PASSENGER = "passenger";
    private static final String PASSENGER_LAYER = "passenger-layer";
    private static final String PASSENGER_SOURCE = "passenger-source";
    private static final String TAXI = "taxi";
    private static final String TAXI_LAYER = "taxi-layer";
    private static final String TAXI_SOURCE = "taxi-source";
    private static final String RANDOM_CAR_LAYER = "random-car-layer";
    private static final String RANDOM_CAR_SOURCE = "random-car-source";
    private static final String RANDOM_CAR_IMAGE_ID = "random-car";
    private static final String PROPERTY_BEARING = "bearing";
    private static final int DURATION_RANDOM_MAX = 1500;
    private static final int DURATION_BASE = 3000;

    private final Random random = new Random();

    private MapView mapView;
    private MapboxMap mapboxMap;

    private List<Car> randomCars = new ArrayList<>();
    private GeoJsonSource randomCarSource;
    private Car taxi;
    private GeoJsonSource taxiSource;
    private LatLng passenger;

    private List<Animator> animators = new ArrayList<>();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Mapbox.getInstance(this, getString(R.string.access_token));
        setContentView(R.layout.activity_animated_symbol_layer);

        mapView = findViewById(R.id.mapView);
        mapView.onCreate(savedInstanceState);

        mapView.getMapAsync(new OnMapReadyCallback() {
            @Override
            public void onMapReady(MapboxMap mapboxMap) {
                AnimatedSymbolLayerActivity.this.mapboxMap = mapboxMap;
                setupCars();
                animateRandomRoutes();
                animateTaxi();
            }
        });
    }

    private void setupCars() {
        addRandomCars();
        addPassenger();
        addMainCar();
    }

    private void animateRandomRoutes() {
        final Car longestDrive = getLongestDrive();
        final Random random = new Random();
        for (final Car car : randomCars) {
            final boolean isLongestDrive = longestDrive.equals(car);
            ValueAnimator valueAnimator = ValueAnimator.ofObject(new LatLngEvaluator(), car.current, car.next);
            valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

                private LatLng latLng;

                @Override
                public void onAnimationUpdate(ValueAnimator animation) {
                    latLng = (LatLng) animation.getAnimatedValue();
                    car.current = latLng;
                    if (isLongestDrive) {
                        updateRandomCarSource();
                    }
                }
            });

            if (isLongestDrive) {
                valueAnimator.addListener(new AnimatorListenerAdapter() {
                    @Override
                    public void onAnimationEnd(Animator animation) {
                        super.onAnimationEnd(animation);
                        updateRandomDestinations();
                        animateRandomRoutes();
                    }
                });
            }

            valueAnimator.addListener(new AnimatorListenerAdapter() {
                @Override
                public void onAnimationStart(Animator animation) {
                    super.onAnimationStart(animation);
                    car.feature.addNumberProperty("bearing", Car.getBearing(car.current, car.next));
                }
            });

            int offset = random.nextInt(2) == 0 ? 0 : random.nextInt(1000) + 250;
            valueAnimator.setStartDelay(offset);
            valueAnimator.setDuration(car.duration - offset);
            valueAnimator.setInterpolator(new LinearInterpolator());
            valueAnimator.start();

            animators.add(valueAnimator);
        }
    }

    private void animateTaxi() {
        ValueAnimator valueAnimator = ValueAnimator.ofObject(new LatLngEvaluator(), taxi.current, taxi.next);
        valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

            private LatLng latLng;

            @Override
            public void onAnimationUpdate(ValueAnimator animation) {
                latLng = (LatLng) animation.getAnimatedValue();
                taxi.current = latLng;
                updateTaxiSource();
            }
        });

        valueAnimator.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                super.onAnimationEnd(animation);
                updatePassenger();
                animateTaxi();
            }
        });

        valueAnimator.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationStart(Animator animation) {
                super.onAnimationStart(animation);
                taxi.feature.addNumberProperty("bearing", Car.getBearing(taxi.current, taxi.next));
            }
        });

        valueAnimator.setDuration((long) (7 * taxi.current.distanceTo(taxi.next)));
        valueAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
        valueAnimator.start();

        animators.add(valueAnimator);
    }

    private void updatePassenger() {
        passenger = getLatLngInBounds();
        updatePassengerSource();
        taxi.setNext(passenger);
    }

    private void updatePassengerSource() {
        GeoJsonSource source = mapboxMap.getSourceAs(PASSENGER_SOURCE);
        FeatureCollection featureCollection = FeatureCollection.fromFeatures(new Feature[] {
                Feature.fromGeometry(
                        Point.fromLngLat(
                                passenger.getLongitude(),
                                passenger.getLatitude()
                        )
                )
        });
        source.setGeoJson(featureCollection);
    }

    private void updateTaxiSource() {
        taxi.updateFeature();
        taxiSource.setGeoJson(taxi.feature);
    }

    private void updateRandomDestinations() {
        for (Car randomCar : randomCars) {
            randomCar.setNext(getLatLngInBounds());
        }
    }

    private Car getLongestDrive() {
        Car longestDrive = null;
        for (Car randomCar : randomCars) {
            if (longestDrive == null) {
                longestDrive = randomCar;
            } else if (longestDrive.duration < randomCar.duration) {
                longestDrive = randomCar;
            }
        }
        return longestDrive;
    }

    private void updateRandomCarSource() {
        for (Car randomCarsRoute : randomCars) {
            randomCarsRoute.updateFeature();
        }
        randomCarSource.setGeoJson(featuresFromRoutes());
    }

    private FeatureCollection featuresFromRoutes() {
        List<Feature> features = new ArrayList<>();
        for (Car randomCarsRoute : randomCars) {
            features.add(randomCarsRoute.feature);
        }
        return FeatureCollection.fromFeatures(features);
    }

    private long getDuration() {
        return random.nextInt(DURATION_RANDOM_MAX) + DURATION_BASE;
    }

    private void addRandomCars() {
        LatLng latLng;
        LatLng next;
        for (int i = 0; i < 150; i++) {
            latLng = getLatLngInBounds();
            next = getLatLngInBounds();

            JsonObject properties = new JsonObject();
            properties.addProperty(PROPERTY_BEARING, Car.getBearing(latLng, next));

            Feature feature = Feature.fromGeometry(
                    Point.fromLngLat(
                            latLng.getLongitude(),
                            latLng.getLatitude()
                    ), properties);

            randomCars.add(
                    new Car(feature, next, getDuration())
            );
        }

        randomCarSource = new GeoJsonSource(RANDOM_CAR_SOURCE, featuresFromRoutes());
        mapboxMap.addSource(randomCarSource);
        mapboxMap.addImage(RANDOM_CAR_IMAGE_ID,
                ((BitmapDrawable) getResources().getDrawable(R.drawable.random_car)).getBitmap());

        SymbolLayer symbolLayer = new SymbolLayer(RANDOM_CAR_LAYER, RANDOM_CAR_SOURCE);
        symbolLayer.withProperties(
                iconImage(RANDOM_CAR_IMAGE_ID),
                iconAllowOverlap(true),
                PropertyFactory.iconRotate(Expression.get(PROPERTY_BEARING)),
                iconIgnorePlacement(true)
        );

        mapboxMap.addLayer(symbolLayer);
    }

    private void addPassenger() {
        passenger = getLatLngInBounds();
        FeatureCollection featureCollection = FeatureCollection.fromFeatures(new Feature[] {
                Feature.fromGeometry(
                        Point.fromLngLat(
                                passenger.getLongitude(),
                                passenger.getLatitude()
                        )
                )
        });

        mapboxMap.addImage(PASSENGER,
                ((BitmapDrawable) getResources().getDrawable(R.drawable.passenger)).getBitmap());

        GeoJsonSource geoJsonSource = new GeoJsonSource(PASSENGER_SOURCE, featureCollection);
        mapboxMap.addSource(geoJsonSource);

        SymbolLayer symbolLayer = new SymbolLayer(PASSENGER_LAYER, PASSENGER_SOURCE);
        symbolLayer.withProperties(
                iconImage(PASSENGER),
                iconIgnorePlacement(true),
                iconAllowOverlap(true)
        );
        mapboxMap.addLayer(symbolLayer);
    }

    private void addMainCar() {
        LatLng latLng = getLatLngInBounds();
        JsonObject properties = new JsonObject();
        properties.addProperty(PROPERTY_BEARING, Car.getBearing(latLng, passenger));
        Feature feature = Feature.fromGeometry(
                Point.fromLngLat(
                        latLng.getLongitude(),
                        latLng.getLatitude()), properties);
        FeatureCollection featureCollection = FeatureCollection.fromFeatures(new Feature[] {feature});

        taxi = new Car(feature, passenger, getDuration());
        mapboxMap.addImage(TAXI,
                ((BitmapDrawable) getResources().getDrawable(R.drawable.taxi)).getBitmap());
        taxiSource = new GeoJsonSource(TAXI_SOURCE, featureCollection);
        mapboxMap.addSource(taxiSource);

        SymbolLayer symbolLayer = new SymbolLayer(TAXI_LAYER, TAXI_SOURCE);
        symbolLayer.withProperties(
                iconImage(TAXI),
                PropertyFactory.iconRotate(Expression.get(PROPERTY_BEARING)),
                iconAllowOverlap(true),
                iconIgnorePlacement(true)

        );
        mapboxMap.addLayer(symbolLayer);
    }

    private LatLng getLatLngInBounds() {
        LatLngBounds bounds = mapboxMap.getProjection().getVisibleRegion().latLngBounds;
        Random generator = new Random();
        double randomLat = bounds.getLatSouth() + generator.nextDouble()
                * (bounds.getLatNorth() - bounds.getLatSouth());
        double randomLon = bounds.getLonWest() + generator.nextDouble()
                * (bounds.getLonEast() - bounds.getLonWest());
        return new LatLng(randomLat, randomLon);
    }

    @Override
    protected void onStart() {
        super.onStart();
        mapView.onStart();
    }

    @Override
    protected void onResume() {
        super.onResume();
        mapView.onResume();
    }

    @Override
    protected void onPause() {
        super.onPause();
        mapView.onPause();
    }

    @Override
    protected void onStop() {
        super.onStop();
        mapView.onStop();
    }

    @Override
    protected void onSaveInstanceState(Bundle outState) {
        super.onSaveInstanceState(outState);
        mapView.onSaveInstanceState(outState);
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();

        for (Animator animator : animators) {
            if (animator != null) {
                animator.removeAllListeners();
                animator.cancel();
            }
        }

        mapView.onDestroy();
    }

    @Override
    public void onLowMemory() {
        super.onLowMemory();
        mapView.onLowMemory();
    }

    /**
     * Evaluator for LatLng pairs
     */
    private static class LatLngEvaluator implements TypeEvaluator<LatLng> {

        private LatLng latLng = new LatLng();

        @Override
        public LatLng evaluate(float fraction, LatLng startValue, LatLng endValue) {
            latLng.setLatitude(startValue.getLatitude()
                    + ((endValue.getLatitude() - startValue.getLatitude()) * fraction));
            latLng.setLongitude(startValue.getLongitude()
                    + ((endValue.getLongitude() - startValue.getLongitude()) * fraction));
            return latLng;
        }
    }


    private static class Car {
        private Feature feature;
        private LatLng next;
        private LatLng current;
        private long duration;

        Car(Feature feature, LatLng next, long duration) {
            this.feature = feature;
            Geometry geometry = feature.geometry();
            if (geometry instanceof Point) {
                Point point = ((Point) geometry);
                this.current = new LatLng(point.latitude(), point.longitude());
            }
            this.duration = duration;
            this.next = next;
        }

        void setNext(LatLng next) {
            this.next = next;
        }

        void updateFeature() {
            feature = Feature.fromGeometry(Point.fromLngLat(
                    current.getLongitude(),
                    current.getLatitude())
            );
            feature.addNumberProperty("bearing", getBearing(current, next));
        }

        private static float getBearing(LatLng from, LatLng to) {
            return (float)(Math.random() * 359.0);
        }
    }
}

This also happened on a BLU R1 HD phone as well. I used custom images in the app (both the ones that we show in our app, and a tree icon that I made quickly). I've had the phone connected to a debugger when running the test app. I just have com.android.support dependencies in addition to the mapbox SDK dependency.

On a side note, I'm running the test app on the Huawei tablet again, and it's still running. Apparently it doesn't crash as quickly when not connected to the debugger (if it is indeed going to crash this time). I'll keep doing some testing and attach more information if I find out anything useful.

@mbrame12
Copy link
Author

mbrame12 commented Apr 5, 2018

I left the Huawei tablet running the test app for over an hour (not connected to the debugger), and it did not crash. I then restarted the test app connected to the debugger, and it crashed in about 7 minutes (with the weak global reference table overflow).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Android Mapbox Maps SDK for Android
Projects
None yet
Development

No branches or pull requests

3 participants