nativescript-community / ui-mapbox

Interactive, thoroughly customizable maps powered by vector tiles and OpenGL.
34 stars 25 forks source link

Error occurred while initializing telemetry #83

Open youssefgh opened 2 years ago

youssefgh commented 2 years ago
2022-07-08 04:14:05.775 21921-21921/org.nativescript.testApp E/Mbgl-Mapbox: Error occurred while initializing telemetry
    java.lang.IllegalArgumentException: org.nativescript.testApp: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
    Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles.
        at android.app.PendingIntent.checkFlags(PendingIntent.java:401)
        at android.app.PendingIntent.getBroadcastAsUser(PendingIntent.java:671)
        at android.app.PendingIntent.getBroadcast(PendingIntent.java:658)
        at com.mapbox.android.telemetry.AlarmSchedulerFlusher.register(AlarmSchedulerFlusher.java:31)
        at com.mapbox.android.telemetry.MapboxTelemetry.startAlarm(MapboxTelemetry.java:380)
        at com.mapbox.android.telemetry.MapboxTelemetry.startTelemetry(MapboxTelemetry.java:374)
        at com.mapbox.android.telemetry.MapboxTelemetry.enable(MapboxTelemetry.java:114)
        at com.mapbox.mapboxsdk.module.telemetry.TelemetryImpl.<init>(TelemetryImpl.java:33)
        at com.mapbox.mapboxsdk.ModuleProviderImpl.obtainTelemetry(ModuleProviderImpl.java:22)
        at com.mapbox.mapboxsdk.Mapbox.initializeTelemetry(Mapbox.java:167)
        at com.mapbox.mapboxsdk.Mapbox.getInstance(Mapbox.java:64)
        at com.tns.Runtime.callJSMethodNative(Native Method)
        at com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1302)
        at com.tns.Runtime.callJSMethodImpl(Runtime.java:1188)
        at com.tns.Runtime.callJSMethod(Runtime.java:1175)
        at com.tns.Runtime.callJSMethod(Runtime.java:1153)
        at com.tns.Runtime.callJSMethod(Runtime.java:1149)
        at com.tns.gen.java.lang.Runnable.run(Runnable.java:17)
        at android.os.Handler.handleCallback(Handler.java:942)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loopOnce(Looper.java:201)
        at android.os.Looper.loop(Looper.java:288)
        at android.app.ActivityThread.main(ActivityThread.java:7892)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)

Device :

Android Emulator API 33

How to reproduce :

create a new NS app, add ui-mapbox plugin [,add TelemetryService] and create a basic component that shows a map

Workaround in dev environment :

upgrade mapboxTelemetry in node_modules/@nativescript-community/ui-mapbox/platforms/android/include.gradle with : def mapboxTelemetryVersion = "8.0.0"

mapboxTelemetry 8.0.0 seems compatible with android API 31+ but am not sure about cross compatibility with other mapbox dependencies

youssefgh commented 2 years ago

Putting :

project.ext {
  mapboxTelemetryVersion = "8.0.0"
}

in App_Resources/Android/before-plugins.gradle seems like a solution but waiting for plugin devs input