Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: LocationLayer Plugin 3.0 #266

Closed
psinetron opened this issue Jan 31, 2018 · 15 comments
Closed

Bug: LocationLayer Plugin 3.0 #266

psinetron opened this issue Jan 31, 2018 · 15 comments
Labels
bug A bug is found inside the code base and should be immediately brought to attention ASAP location-layer-plugin Issues that deal with the location layer module

Comments

@psinetron
Copy link

Often bug when App stoped and started

signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0
    x0   0000007f8a051bc0  x1   0000007fff98f1d8  x2   0000007fabc81a08  x3   0000000000000020
    x4   0000007fac16b330  x5   00000000000000b6  x6   0000007fac16a000  x7   0000000000000000
    x8   0000000000000000  x9   000000000ca293dc  x10  000000003b9aca00  x11  0000000000000000
    x12  0000000000000018  x13  ffffffffa5990871  x14  000797cc74000000  x15  003b9aca00000000
    x16  0000007f7feaedf8  x17  0000007fabc819d4  x18  0000000000000008  x19  0000007f8a051b80
    x20  0000007fac154370  x21  0000007fac154370  x22  0000007fac154370  x23  0000007fac154370
    x24  0000000000000000  x25  0000000000000000  x26  000000002942ee29  x27  000000006ffabf28
    x28  0000000000000000  x29  0000007fff98f350  x30  0000007f7fadcc00
    sp   0000007fff98f1c0  pc   0000007f7fadcc04  pstate 0000000060000000

backtrace:
    #00 pc 000000000026fc04  /data/app/ru.trend.handymap-2/lib/arm64/libmapbox-gl.so
    #01 pc 00000000002e3e24  /data/app/ru.trend.handymap-2/lib/arm64/libmapbox-gl.so
    #02 pc 00000000003010ac  /data/app/ru.trend.handymap-2/lib/arm64/libmapbox-gl.so
    #03 pc 00000000000eb060  /data/app/ru.trend.handymap-2/lib/arm64/libmapbox-gl.so
    #04 pc 00000000000e6fc0  /data/app/ru.trend.handymap-2/lib/arm64/libmapbox-gl.so
    #05 pc 00000000000e6d08  /data/app/ru.trend.handymap-2/lib/arm64/libmapbox-gl.so
    #06 pc 0000000000135f30  /data/app/ru.trend.handymap-2/lib/arm64/libmapbox-gl.so
    #07 pc 0000000000135f84  /data/app/ru.trend.handymap-2/lib/arm64/libmapbox-gl.so
    #08 pc 0000000000e8e164  /data/app/ru.trend.handymap-2/oat/arm64/base.odex (offset 0xa29000) (void com.mapbox.mapboxsdk.style.layers.Layer.nativeSetLayoutProperty(java.lang.String, java.lang.Object)+184)
    #09 pc 0000000000e8e940  /data/app/ru.trend.handymap-2/oat/arm64/base.odex (offset 0xa29000) (void com.mapbox.mapboxsdk.style.layers.Layer.setProperties(com.mapbox.mapboxsdk.style.layers.PropertyValue[])+468)
    #10 pc 0000000000e8266c  /data/app/ru.trend.handymap-2/oat/arm64/base.odex (offset 0xa29000) (void com.mapbox.mapboxsdk.plugins.locationlayer.LocationLayer.setLayerBearing(java.lang.String, float)+416)
    #11 pc 0000000001306d0c  /data/app/ru.trend.handymap-2/oat/arm64/base.odex (offset 0xa29000) (void com.mapbox.mapboxsdk.plugins.locationlayer.LocationLayerPlugin.setBearing(float)+176)
    #12 pc 0000000001305c88  /data/app/ru.trend.handymap-2/oat/arm64/base.odex (offset 0xa29000) (void com.mapbox.mapboxsdk.plugins.locationlayer.LocationLayerPlugin.access$200(com.mapbox.mapboxsdk.plugins.locationlayer.LocationLayerPlugin, float)+76)
    #13 pc 0000000000e83ed0  /data/app/ru.trend.handymap-2/oat/arm64/base.odex (offset 0xa29000) (void com.mapbox.mapboxsdk.plugins.locationlayer.LocationLayerPlugin$2.onAnimationUpdate(android.animation.ValueAnimator)+244)
    #14 pc 00000000033ccdbc  /system/framework/arm64/boot.oat (offset 0x28ed000)
@tobrun
Copy link
Member

tobrun commented Jan 31, 2018

@psinetron stopped and started, can you confirm that this is onStop/onStart (eg. using the home button) or with killing and reopening the app?

cc @cammace

@psinetron
Copy link
Author

Yes when onStop/OnStart like press home button
Very often when onStop() event

@kingfisherphuoc
Copy link

#265 I got the same issue and reported yesterday.

@psinetron
Copy link
Author

psinetron commented Jan 31, 2018

Yes. A similar problem.
Just in case my code (Kotlin):

locationEngine = LostLocationEngine(context)
        locationEngine?.priority = LocationEnginePriority.HIGH_ACCURACY
        locationEngine?.addLocationEngineListener(this)
        locationEngine?.activate()
        locationPlugin = LocationLayerPlugin(mapView, map, locationEngine)
        runLocationLayer()
...
fun runLocationLayer() {
        if (ActivityCompat.checkSelfPermission(getView().getContext(), Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED ||
                ActivityCompat.checkSelfPermission(getView().getContext(), Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
            locationPlugin?.setLocationLayerEnabled(LocationLayerMode.COMPASS)
        }
    }

@cammace cammace added bug A bug is found inside the code base and should be immediately brought to attention ASAP location-layer-plugin Issues that deal with the location layer module labels Feb 15, 2018
@cammace
Copy link
Contributor

cammace commented Feb 15, 2018

@psinetron can you move your permission check before locationEngine?.activate()? When activate gets called, the onConnected inside LocationLayerPlugin gets invoked and begins requesting location updates if the engine provided isn't null (in your case it isn't).

@psinetron
Copy link
Author

psinetron commented Feb 16, 2018

@cammace yes, thank you. I moved check, but this does not fix the problem. All permissions is granded

@psinetron
Copy link
Author

psinetron commented Mar 6, 2018

Error again.
Location layer 0.4.0
mapbox 5.4.1

Build fingerprint: 'Xiaomi/nikel/nikel:6.0/MRA58K/V9.2.2.0.MBFMIEK:user/release-keys'
Revision: '0'
ABI: 'arm64'
pid: 16544, tid: 16544, name: beaver.handymap  >>> ru.slybeaver.handymap <<<
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0
    x0   0000007f84e067c0  x1   0000007fd0c6bb38  x2   0000007fa3fcea08  x3   0000000000000003
    x4   0000007fa44b8330  x5   0000000000000038  x6   0000007fa44b7000  x7   0000000000000000
    x8   0000000000000000  x9   0000000017845ced  x10  000000003b9aca00  x11  0000000000000000
    x12  0000000000000018  x13  ffffffffa567531e  x14  003020f4e5000000  x15  003b9aca00000000
    x16  0000007f78012df8  x17  0000007fa3fce9d4  x18  0000007fa409bf50  x19  0000007f84e06780
    x20  0000007fa44a1370  x21  0000007fa44a1370  x22  0000007fa44a1370  x23  0000007fa44a1370
    x24  00000000ffffffff  x25  0000000000000000  x26  00000000175e1f5a  x27  000000006ffabf28
    x28  0000000000000000  x29  0000007fd0c6bcb0  x30  0000007f77c3f3b0
    sp   0000007fd0c6bb20  pc   0000007f77c3f3b4  pstate 0000000060000000

backtrace:
    #00 pc 00000000002703b4  /data/app/ru.slybeaver.handymap-2/lib/arm64/libmapbox-gl.so
    #01 pc 00000000002e461c  /data/app/ru.slybeaver.handymap-2/lib/arm64/libmapbox-gl.so
    #02 pc 00000000003018a4  /data/app/ru.slybeaver.handymap-2/lib/arm64/libmapbox-gl.so
    #03 pc 00000000000eb508  /data/app/ru.slybeaver.handymap-2/lib/arm64/libmapbox-gl.so
    #04 pc 00000000000e7468  /data/app/ru.slybeaver.handymap-2/lib/arm64/libmapbox-gl.so
    #05 pc 00000000000e71b0  /data/app/ru.slybeaver.handymap-2/lib/arm64/libmapbox-gl.so
    #06 pc 00000000001363d8  /data/app/ru.slybeaver.handymap-2/lib/arm64/libmapbox-gl.so
    #07 pc 000000000013642c  /data/app/ru.slybeaver.handymap-2/lib/arm64/libmapbox-gl.so
    #08 pc 0000000000e9c684  /data/app/ru.slybeaver.handymap-2/oat/arm64/base.odex (offset 0xa32000) (void com.mapbox.mapboxsdk.style.layers.Layer.nativeSetLayoutProperty(java.lang.String, java.lang.Object)+184)
    #09 pc 0000000000e9ce60  /data/app/ru.slybeaver.handymap-2/oat/arm64/base.odex (offset 0xa32000) (void com.mapbox.mapboxsdk.style.layers.Layer.setProperties(com.mapbox.mapboxsdk.style.layers.PropertyValue[])+468)
    #10 pc 0000000000e8d4dc  /data/app/ru.slybeaver.handymap-2/oat/arm64/base.odex (offset 0xa32000) (void com.mapbox.mapboxsdk.plugins.locationlayer.LocationLayer.setLayerBearing(java.lang.String, float)+416)
    #11 pc 000000000131bacc  /data/app/ru.slybeaver.handymap-2/oat/arm64/base.odex (offset 0xa32000) (void com.mapbox.mapboxsdk.plugins.locationlayer.LocationLayerPlugin.setBearing(float)+176)
    #12 pc 000000000131a828  /data/app/ru.slybeaver.handymap-2/oat/arm64/base.odex (offset 0xa32000) (void com.mapbox.mapboxsdk.plugins.locationlayer.LocationLayerPlugin.access$200(com.mapbox.mapboxsdk.plugins.locationlayer.LocationLayerPlugin, float)+76)
    #13 pc 0000000000e91250  /data/app/ru.slybeaver.handymap-2/oat/arm64/base.odex (offset 0xa32000) (void com.mapbox.mapboxsdk.plugins.locationlayer.LocationLayerPlugin$2.onAnimationUpdate(android.animation.ValueAnimator)+244)
    #14 pc 00000000033ccdbc  /system/framework/arm64/boot.oat (offset 0x28ed000)

@Alton09
Copy link

Alton09 commented Mar 22, 2018

@tobrun @cammace I believe I have a similar issue here. I have a fragment that has a MapView, and another fragment that shows stats about the user's progress on a hiking trail. When I switch to the stats fragment, I need to pause the LocationLayerPlugin since the MapView is no longer in focus to provide UI updates, but I need to keep tracking their location (via the LocationEngine) to continue validating the user's position. The LocationLayerPlugin's onStop() method works fine, but I get an error when invoking onStart() from the MapView fragment's onStart() method.

Below is what I see in the logs after the crash:

03-21 07:00:32.957 28206-28206/com.blwolfe.android.trailwinner A/libc: Pure virtual function called. Are you calling virtual methods from a destructor?
03-21 07:00:32.957 28206-28206/com.blwolfe.android.trailwinner A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 28206 (oid.trailwinner)

Here's how I am starting the LocationEngine and LocationLayerPlugin, and invoking onStop() and onStart():

    /**
     * Initializes and starts location tracking.
     */
    @SuppressLint("MissingPermission")
    public LocationManagerImpl(ContextWrapper contextWrapper, MapPresenter mapPresenter,
                               MapView mapView, MapboxMap mapboxMap, LatLng startPosition,
                               LatLng endPosition) {
        MapActivity mapActivity = (MapActivity) contextWrapper.getContext();
        mMapPresenter = mapPresenter;
        mStartPosition = startPosition;
        mEndPosition = endPosition;
        mLocationWrapper = new LocationWrapper();
        mHasTrailStarted = new AtomicBoolean();
        mLocationEngine = new LostLocationEngine(mapActivity);
        mLocationEngine.setPriority(LocationEnginePriority.HIGH_ACCURACY);
        mLocationEngine.addLocationEngineListener(this);
        mLocationEngine.setInterval(1000);
        mLocationEngine.activate();
        mLocationLayerPlugin = new LocationLayerPlugin(mapView,
                mapboxMap, mLocationEngine);
        mLocationLayerPlugin.setLocationLayerEnabled(LocationLayerMode.TRACKING);
    }

    @SuppressLint("MissingPermission")
    @Override
    public void onStartLocation() {
        if (mLocationLayerPlugin != null) {
            mLocationLayerPlugin.onStart();
        }
    }

    @Override
    public void onStopLocation() {
        if (mLocationLayerPlugin != null) {
            mLocationLayerPlugin.onStop();
        }
    }

I've also tried handling the runtime exceptions without @SuppressLint, but no luck.

I'm using the following Mapbox dependencies:

mapbox-android-plugin-locationlayer:0.4.0
mapbox-android-navigation:0.8.0

Any help on this would be greatly appreciated!

@cammace
Copy link
Contributor

cammace commented Apr 18, 2018

Now that 6.0.1 of the Map SDK and 0.5.0-beta.2 is available with significant changes on both ends, I'd love if you guys could retest this issue and see if it still exist.

@cammace
Copy link
Contributor

cammace commented Apr 18, 2018

For now, i'm closing this issue but can reopen if the issue still exists even after updating.

@cammace cammace closed this as completed Apr 18, 2018
@JTGaag
Copy link

JTGaag commented Apr 19, 2018

For everyone having this issue. I tried to fix this bug in my projected with the 0.5.0-beta.2 version.
After some time I got it working by mainly looking at the LocationLayerModesActivity (https://github.com/mapbox/mapbox-plugins-android/blob/master/app/src/main/java/com/mapbox/mapboxsdk/plugins/testapp/activity/location/LocationLayerModesActivity.java)

I changed the following points compared to the previous version where I used the LostLocationEngine:

  • Change the LostLocationEngine to com.mapbox.android.core.location.LocationEngine
  • locationLayerPlugin.setLocationLayerEnabled(MODE) => locationLayerPlugin.setLocationLayerEnabled(true)
  • add: locationLayerPlugin.setRenderMode(MODE)
  • add locationPlugin as lifecycleObserver => getLifecycle().addObserver(locationLayerPlugin) [line 128 of LocationLayerModesActivity]

I use the map in a fragment and use Android architecture components. I hope these small points will save you guys some time.

@psinetron
Copy link
Author

psinetron commented Apr 19, 2018

Thanks! Will test tomorrow

@EvangelosG
Copy link

@psinetron how did it go?

@albert0m
Copy link

albert0m commented Apr 27, 2018

after updating to 0.5.0 I get the error:

Error:(95, 5) error: resource style/LocationLayer (aka my.bundle:style/LocationLayer) not found.

@cammace
Copy link
Contributor

cammace commented Apr 27, 2018

@marconealberto Change the style resource name to mapbox_LocationLayer, see https://github.com/mapbox/mapbox-plugins-android/blob/master/plugin-locationlayer/src/main/res/values/styles.xml#L4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A bug is found inside the code base and should be immediately brought to attention ASAP location-layer-plugin Issues that deal with the location layer module
Projects
None yet
Development

No branches or pull requests

8 participants