flutter-mapbox-gl / maps

A Mapbox GL flutter package for creating custom maps
Other
1.04k stars 502 forks source link

FATAL EXCEPTION: MapboxTelemetryExecutor #1089

Closed tiago-pinto closed 2 years ago

tiago-pinto commented 2 years ago

Hello,

I have a flutter app that uses mapbox_gl and it does run perfectly in debug, but in release it will crash whenever it loads something related to mapbox(either loadding the map widget or event downloading a offline zone).

StackTrace:

E/AndroidRuntime(27161): FATAL EXCEPTION: MapboxTelemetryExecutor
E/AndroidRuntime(27161): Process: peakit.findify.app.trilhosdaborralha, PID: 27161
E/AndroidRuntime(27161): java.lang.RuntimeException: Unable to invoke no-args constructor for class com.mapbox.android.telemetry.CrashEvent. Registering an InstanceCreator with Gson for this type may fix this problem.
E/AndroidRuntime(27161):    at com.google.gson.B.f.a(Unknown Source:32)
E/AndroidRuntime(27161):    at com.google.gson.B.B.n$a.read(Unknown Source:15)
E/AndroidRuntime(27161):    at com.google.gson.j.c(Unknown Source:20)
E/AndroidRuntime(27161):    at com.google.gson.j.e(:2)
E/AndroidRuntime(27161):    at d.d.c.s.a.h.f(:1)
E/AndroidRuntime(27161):    at com.mapbox.android.telemetry.errors.b.g(:2)
E/AndroidRuntime(27161):    at com.mapbox.android.telemetry.errors.c.b(:3)
E/AndroidRuntime(27161):    at com.mapbox.android.telemetry.errors.c$a.run(Unknown Source:2)
E/AndroidRuntime(27161):    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
E/AndroidRuntime(27161):    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
E/AndroidRuntime(27161):    at java.lang.Thread.run(Thread.java:919)
E/AndroidRuntime(27161): Caused by: java.lang.reflect.InvocationTargetException
E/AndroidRuntime(27161):    at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(27161):    at com.google.gson.B.w.b(Unknown Source:13)
E/AndroidRuntime(27161):    at com.google.gson.B.f.a(Unknown Source:4)
E/AndroidRuntime(27161):    ... 10 more
E/AndroidRuntime(27161): Caused by: java.lang.ExceptionInInitializerError
E/AndroidRuntime(27161):    at sun.misc.Unsafe.allocateInstance(Native Method)
E/AndroidRuntime(27161):    ... 13 more
E/AndroidRuntime(27161): Caused by: java.lang.RuntimeException: java.lang.NoSuchMethodException: com.mapbox.android.telemetry.q$a.values []
E/AndroidRuntime(27161):    at java.lang.Enum.enumValues(Enum.java:270)
E/AndroidRuntime(27161):    at java.lang.Enum.access$000(Enum.java:61)
E/AndroidRuntime(27161):    at java.lang.Enum$1.create(Enum.java:277)
E/AndroidRuntime(27161):    at java.lang.Enum$1.create(Enum.java:275)
E/AndroidRuntime(27161):    at libcore.util.BasicLruCache.get(BasicLruCache.java:63)
E/AndroidRuntime(27161):    at java.lang.Enum.getSharedConstants(Enum.java:289)
E/AndroidRuntime(27161):    at java.lang.Class.getEnumConstantsShared(Class.java:2428)
E/AndroidRuntime(27161):    at java.util.EnumSet.getUniverse(EnumSet.java:407)
E/AndroidRuntime(27161):    at java.util.EnumSet.noneOf(EnumSet.java:109)
E/AndroidRuntime(27161):    at java.util.EnumSet.of(EnumSet.java:258)
E/AndroidRuntime(27161):    at com.mapbox.android.telemetry.q.<clinit>(Unknown Source:6)
E/AndroidRuntime(27161):    ... 14 more
E/AndroidRuntime(27161): Caused by: java.lang.NoSuchMethodException: com.mapbox.android.telemetry.q$a.values []
E/AndroidRuntime(27161):    at java.lang.Class.getMethod(Class.java:2072)
E/AndroidRuntime(27161):    at java.lang.Class.getDeclaredMethod(Class.java:2050)
E/AndroidRuntime(27161):    at java.lang.Enum.enumValues(Enum.java:267)
E/AndroidRuntime(27161):    ... 24 more

I am using mapbox_gl: 0.16.0

[✓] Flutter (Channel stable, 2.10.4, on macOS 12.3.1 21E258 darwin-x64, locale en-PT)
    • Flutter version 2.10.4 at /Users/tiagopinto/flutter/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision c860cba910 (3 months ago), 2022-03-25 00:23:12 -0500
    • Engine revision 57d3bac3dd
    • Dart version 2.16.2
    • DevTools version 2.9.2

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at /Users/tiagopinto/Library/Android/sdk
    • Platform android-31, build-tools 30.0.3
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.3.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • CocoaPods version 1.10.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2020.3)
    • 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.10+0-b96-7281165)

[✓] VS Code (version 1.68.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.42.0

[✓] HTTP Host Availability
    • All required HTTP hosts are available

Any help would be great, I am lost in this issue at least for a day

tiago-pinto commented 2 years ago

At the moment after many hours of recearch i found this post that said to add a line to proguardfile and it did indeed fix my issue: https://issuemode.com/issues/mapbox/mapbox-gl-native-android/834066

-keep class com.mapbox.android.telemetry.** { *; }

Will leave issue open because i don't know if this is a adequate fix for this issue

stale[bot] commented 2 years ago

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.

marcoabat commented 1 year ago

At the moment after many hours of recearch i found this post that said to add a line to proguardfile and it did indeed fix my issue: https://issuemode.com/issues/mapbox/mapbox-gl-native-android/834066

-keep class com.mapbox.android.telemetry.** { *; }

Will leave issue open because i don't know if this is a adequate fix for this issue

I'm having the same issue in debug-mode. The link you posted is dead and I don't know where to add -keep class com.mapbox.android.telemetry.** { *; }