eopeter / flutter_mapbox_navigation

Turn By Turn Navigation for Your Flutter Application
Apache License 2.0
217 stars 184 forks source link

App crashed while build with mapbox-maps-flutter in runtime #210

Closed felixfok-dh closed 1 year ago

felixfok-dh commented 1 year ago

I can build and run the example route of the flutter_mapbox_navigation successfully. However, if I add flutter_mapbox_navigation with the official mapbox flutter SDK mapbox-maps-flutter it will be crash immediately without any error or warning. I wonder is it not compatible with the mapbox-maps-flutter? I directly add the mapbox-maps-flutter into the flutter_mapbox_navigation example project after I build success for minus any missing config of flutter_mapbox_navigation, but still crashed.

Below is the debug console log:

Launching lib/main.dart on SM N9750 in debug mode...
main.dart:1
✓  Built build/app/outputs/flutter-apk/app-debug.apk.
Connecting to VM Service at ws://127.0.0.1:61914/rCXLBt2xbdY=/ws
D/LeakCanary(23083): Setting up flushing for Thread[ConnectivityThread,10,main]
D/LeakCanary(23083): Setting up flushing for Thread[GoogleApiHandler,10,main]
D/LeakCanary(23083): Setting up flushing for Thread[fusedLocationClientHandlerThread,10,main]
D/LeakCanary(23083): Setting up flushing for Thread[LeakCanary-Heap-Dump,5,main]
W/igation_exampl(23083): Accessing hidden field Landroid/graphics/Typeface;->sSystemFontMap:Ljava/util/Map; (greylist, reflection, allowed)
I/Mbgl-FontUtils(23083): Couldn't map font family for local ideograph, using sans-serif instead
I/OpenGLRenderer(23083): RenderNode setPositionListener(0x7856d11280) is called
W/Mapbox  (23083): [TelemetryUtils]: java.lang.SecurityException: getDataNetworkTypeForSubscriber: uid 10265 does not have android.permission.READ_PHONE_STATE.
W/igation_exampl(23083): Accessing hidden field Lsun/misc/Unsafe;->theUnsafe:Lsun/misc/Unsafe; (greylist, reflection, allowed)
W/igation_exampl(23083): Accessing hidden method Lsun/misc/Unsafe;->allocateInstance(Ljava/lang/Class;)Ljava/lang/Object; (greylist, reflection, allowed)
E/ThemeUtils(23083): View class com.mapbox.maps.plugin.compass.CompassViewImpl is an AppCompat widget that can only be used with a Theme.AppCompat theme (or descendant).
D/NetworkSecurityConfig(23083): No Network Security Config specified, using platform default
E/ThemeUtils(23083): View class com.mapbox.maps.plugin.logo.LogoViewImpl is an AppCompat widget that can only be used with a Theme.AppCompat theme (or descendant).
E/ThemeUtils(23083): View class com.mapbox.maps.plugin.attribution.AttributionViewImpl is an AppCompat widget that can only be used with a Theme.AppCompat theme (or descendant).
I/PlatformViewsController(23083): Hosting view in a virtual display for platform view: 0
D/Dialog  (23083): mIsSamsungBasicInteraction = false
D/Dialog  (23083): mIsSamsungBasicInteraction = false, isMetaDataInActivity = false
W/Gralloc3(23083): mapper 3.x is not supported
D/PhoneWindow(23083): forceLight changed to true [] from com.android.internal.policy.PhoneWindow.updateForceLightNavigationBar:4274 com.android.internal.policy.DecorView.updateColorViews:1547 com.android.internal.policy.PhoneWindow.dispatchWindowAttributesChanged:3252 android.view.Window.setFlags:1153 com.android.internal.policy.PhoneWindow.generateLayout:2474
I/MultiWindowDecorSupport(23083): [INFO] isPopOver = false
I/MultiWindowDecorSupport(23083): updateCaptionType >> DecorView@f2a3408[], isFloating: false, isApplication: false, hasWindowDecorCaption: false, hasWindowControllerCallback: false
D/MultiWindowDecorSupport(23083): setCaptionType = 0, DecorView = DecorView@f2a3408[]
W/Gralloc3(23083): allocator 3.x is not supported
D/libmdf  (23083): libmdf v2.9.0.0 On 64bit PLATFORM
I/ViewRootImpl@8ba7052[MainActivity](23083): setView = com.android.internal.policy.DecorView@f2a3408 TM=true MM=false
V/InputMethodManager(23083): Not IME target window, ignoring
D/AndroidRuntime(23083): Shutting down VM
E/AndroidRuntime(23083): FATAL EXCEPTION: main
E/AndroidRuntime(23083): Process: com.eopeter.flutter_mapbox_navigation_example, PID: 23083
E/AndroidRuntime(23083): java.lang.IllegalStateException: Please ensure that the hosting activity/fragment is a valid LifecycleOwner
E/AndroidRuntime(23083):    at com.mapbox.maps.plugin.lifecycle.ViewLifecycleOwner.doOnAttached(ViewLifecycleOwner.kt:68)
E/AndroidRuntime(23083):    at com.mapbox.maps.plugin.lifecycle.ViewLifecycleOwner.<init>(ViewLifecycleOwner.kt:58)
E/AndroidRuntime(23083):    at com.mapbox.maps.plugin.lifecycle.MapboxLifecyclePluginImpl.registerLifecycleObserver(MapboxLifecyclePluginImpl.kt:30)
E/AndroidRuntime(23083):    at com.mapbox.maps.plugin.MapPluginRegistry.onAttachedToWindow(MapPluginRegistry.kt:173)
E/AndroidRuntime(23083):    at com.mapbox.maps.MapController.onAttachedToWindow$sdk_release(MapController.kt:346)
E/AndroidRuntime(23083):    at com.mapbox.maps.MapView.onAttachedToWindow(MapView.kt:123)
E/AndroidRuntime(23083):    at android.view.View.dispatchAttachedToWindow(View.java:21304)
E/AndroidRuntime(23083):    at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:4239)
E/AndroidRuntime(23083):    at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:4246)
E/AndroidRuntime(23083):    at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2571)
E/AndroidRuntime(23083):    at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:2225)
E/AndroidRuntime(23083):    at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:9126)
E/AndroidRuntime(23083):    at android.view.Choreographer$CallbackRecord.run(Choreographer.java:999)
E/AndroidRuntime(23083):    at android.view.Choreographer.doCallbacks(Choreographer.java:797)
E/AndroidRuntime(23083):    at android.view.Choreographer.doFrame(Choreographer.java:732)
E/AndroidRuntime(23083):    at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:984)
E/AndroidRuntime(23083):    at android.os.Handler.handleCallback(Handler.java:883)
E/AndroidRuntime(23083):    at android.os.Handler.dispatchMessage(Handler.java:100)
E/AndroidRuntime(23083):    at android.os.Looper.loop(Looper.java:237)
E/AndroidRuntime(23083):    at android.app.ActivityThread.main(ActivityThread.java:8167)
E/AndroidRuntime(23083):    at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(23083):    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:496)
E/AndroidRuntime(23083):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1100)
I/Process (23083): Sending signal. PID: 23083 SIG: 9
Lost connection to device.
Exited

And the flutter doctor -v:

 Flutter (Channel stable, 3.7.8, on macOS 12.4 21F79 darwin-x64, locale en-GB)
    • Flutter version 3.7.8 on channel stable at /Users/felix.fok/Git/flutter/flutter_SDK/flutter_3.7.8
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 90c64ed42b (13 days ago), 2023-03-21 11:27:08 -0500
    • Engine revision 9aa7816315
    • Dart version 2.19.5
    • DevTools version 2.20.1

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0-rc4)
    • Android SDK at /Users/felix.fok/Library/Android/sdk
    • Platform android-33, build-tools 33.0.0-rc4
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.4.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 13F100
    • CocoaPods version 1.11.3

[✓] Android Studio (version 2021.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)

[✓] VS Code (version 1.77.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension can be installed from:
      🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[✓] Connected device (2 available)
    • SM N9750 (mobile)            • RF8M92G60TD   • android-arm64 • Android 10 (API 29)
    • sdk gphone64 x86 64 (mobile) • emulator-5554 • android-x64   • Android 13 (API 33) (emulator)

[✓] HTTP Host Availability
    • All required HTTP hosts are available
eopeter commented 1 year ago

Please review the common dependencies between them and make sure both have same versions.