mapbox-unity-sdk icon indicating copy to clipboard operation
mapbox-unity-sdk copied to clipboard

Problem With Mapbox Android Files

Open go2actasad opened this issue 5 years ago • 7 comments

Note: If this is a bug or support ticket, please provide the following information:

  • Unity version: 2019.1.14f1
    • Scripting Runtime Version: .Net 4.X Equivalent
    • Scripting Backend: IL2CPP
    • Api Compatibility Level: .Net 4.X
  • Mapbox SDK version: 1.2.0
  • The platform you're building to: Android
  • A description of what you're trying to do: Try to run application on android device. But when I run it got crashed
  • Steps to recreate the bug if appropriate: Add Latest FirebaseMessaging Unity package and Admob Unity Package. After that when run the application and use mapbox sdk feature it got crashed
  • Links to your logs are also helpful:

java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v4/content/ContextCompat; at com.mapbox.services.android.telemetry.permissions.PermissionsManager.isPermissionGranted(PermissionsManager.java:37) at com.mapbox.services.android.telemetry.permissions.PermissionsManager.isCoarseLocationPermissionGranted(PermissionsManager.java:42) at com.mapbox.services.android.telemetry.permissions.PermissionsManager.areLocationPermissionsGranted(PermissionsManager.java:50) at com.mapbox.services.android.telemetry.MapboxTelemetry.setTelemetryEnabled(MapboxTelemetry.java:311) at com.mapbox.services.android.telemetry.MapboxTelemetry.loadUserPreferences(MapboxTelemetry.java:282) at com.mapbox.services.android.telemetry.MapboxTelemetry.initialize(MapboxTelemetry.java:134) at com.unity3d.player.UnityPlayer.nativeRender(Native Method) at com.unity3d.player.UnityPlayer.c(Unknown Source:0)

java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v4/content/LocalBroadcastManager; at com.mapbox.services.android.telemetry.service.TelemetryService.onCreate(TelemetryService.java:41) at android.app.ActivityThread.handleCreateService(ActivityThread.java:4154) at android.app.ActivityThread.access$1500(ActivityThread.java:268) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1998) at android.os.Handler.dispatchMessage(Handler.java:107) at android.os.Looper.loop(Looper.java:237) at android.app.ActivityThread.main(ActivityThread.java:7811) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1068) Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.v4.content.LocalBroadcastManager" on path: DexPathList[[zip file "/data/app/com.go2act.bystander-27iaVGiFlX8ATgaXBs027w==/base.apk"],nativeLibraryDirectories=[/data/app/com.go2act.bystander-27iaVGiFlX8ATgaXBs027w==/lib/arm, /data/app/com.go2act.bystander-27iaVGiFlX8ATgaXBs027w==/base.apk!/lib/armeabi-v7a, /system/lib]] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:196) at java.lang.ClassLoader.loadClass(ClassLoader.java:379) at java.lang.ClassLoader.loadClass(ClassLoader.java:312)

java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v4/content/LocalBroadcastManager; at com.mapbox.services.android.telemetry.service.TelemetryService.onCreate(TelemetryService.java:41) at android.app.ActivityThread.handleCreateService(ActivityThread.java:4154) at android.app.ActivityThread.access$1500(ActivityThread.java:268) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1998) at android.os.Handler.dispatchMessage(Handler.java:107) at android.os.Looper.loop(Looper.java:237) at android.app.ActivityThread.main(ActivityThread.java:7811) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1068) Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.v4.content.LocalBroadcastManager" on path: DexPathList[[zip file "/data/app/com.go2act.bystander-27iaVGiFlX8ATgaXBs027w==/base.apk"],nativeLibraryDirectories=[/data/app/com.go2act.bystander-27iaVGiFlX8ATgaXBs027w==/lib/arm, /data/app/com.go2act.bystander-27iaVGiFlX8ATgaXBs027w==/base.apk!/lib/armeabi-v7a, /system/lib]] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:196) at java.lang.ClassLoader.loadClass(ClassLoader.java:379) at java.lang.ClassLoader.loadClass(ClassLoader.java:312)

go2actasad avatar Apr 01 '20 14:04 go2actasad

first error says something about PermissionsManager.isPermissionGranted. Have you checked if you granted permission for location? try deleting the app cache/storage perhaps?

horatiu665 avatar Apr 03 '20 07:04 horatiu665

@horatiu665 yes I have double checked I have granted permission for location and also clear the cache but error is same.

go2actasad avatar Apr 03 '20 08:04 go2actasad

The latest Firebase package is using the AndroidX libraries. Depending on your settings of the External Dependency Manager for Unity (former Play Services Resolver) this will result in a conflict with not migrated libraries. In theory, EDM4U can solve these conflicts with Jetifier. For this, all the Mapbox libraries need to be in a local maven repository (see here). I created a ticket to support EDM4U here: https://github.com/mapbox/mapbox-unity-sdk/issues/1599

hashtagsheep avatar Apr 16 '20 06:04 hashtagsheep

The latest Firebase package is using the AndroidX libraries. Depending on your settings of the External Dependency Manager for Unity (former Play Services Resolver) this will result in a conflict with not migrated libraries. In theory, EDM4U can solve these conflicts with Jetifier. For this, all the Mapbox libraries need to be in a local maven repository (see here). I created a ticket to support EDM4U here: #1599

Thank you for your response. Have you solved this issue ?

go2actasad avatar Apr 16 '20 07:04 go2actasad

The latest Firebase package is using the AndroidX libraries. Depending on your settings of the External Dependency Manager for Unity (former Play Services Resolver) this will result in a conflict with not migrated libraries. In theory, EDM4U can solve these conflicts with Jetifier. For this, all the Mapbox libraries need to be in a local maven repository (see here). I created a ticket to support EDM4U here: #1599

Thank you for your response. Have you solved this issue ?

I did not find the time yet, but this recommendation was an official answer from Google about a different plugging we are using that had the same error.

hashtagsheep avatar Apr 16 '20 10:04 hashtagsheep

The latest Firebase package is using the AndroidX libraries. Depending on your settings of the External Dependency Manager for Unity (former Play Services Resolver) this will result in a conflict with not migrated libraries. In theory, EDM4U can solve these conflicts with Jetifier. For this, all the Mapbox libraries need to be in a local maven repository (see here). I created a ticket to support EDM4U here: #1599

Thank you for your response. Have you solved this issue ?

I did not find the time yet, but this recommendation was an official answer from Google about a different plugging we are using that had the same error.

Seems like mapbox still not provide any support like this.

go2actasad avatar Apr 20 '20 08:04 go2actasad

For anyone else seeing this, I used this dependency file to specify all the android includes mapbox needs and to ensure it works with EDM4U.

<dependencies>
  <androidPackages>
    <!-- 
    All the packages found in the Mapbox SDK 2.1.1 Unity SDK
     See https://github.com/googlesamples/unity-jar-resolver/blob/8e4659acea42f83d33d34e31e48e4fdbcaa91ea0/sample/Assets/ExternalDependencyManager/Editor/SampleDependencies.xml#L13-L25
     tese packages must be found on Maven Central, Google Maven Repo, or Local Android SDK Maven Repo
     -->
    <androidPackage spec="com.squareup.okhttp3:okhttp:3.8.0" />
    <androidPackage spec="com.squareup.okio:okio:1.13.0" />
    <androidPackage spec="com.android.support:animated-vector-drawable:25.1.0" />
    <androidPackage spec="com.android.support:appcompat-v7:25.1.0" />
    <androidPackage spec="com.google.code.gson:gson:2.8.5" />
    <androidPackage spec="com.android.support:support-compat:25.1.0" />
    <androidPackage spec="com.android.support:support-core-ui:25.1.0" />
    <androidPackage spec="com.android.support:support-core-utils:25.1.0" />
    <androidPackage spec="com.android.support:support-media-compat:25.1.0" />
    <androidPackage spec="com.android.support:support-v4:25.1.0" />
    <androidPackage spec="com.android.support:support-vector-drawable:25.1.0" />
    <!-- this package should include the libcore-release.aar and libtelemetry-full-release.aar packages 
    see https://github.com/mapbox/mapbox-events-android
     from looking inside the arr files the version is 1.4.0 -->
    <androidPackage spec="com.mapbox.mapboxsdk:mapbox-android-core:1.4.0" />
  </androidPackages>
</dependencies>

thsbrown avatar Aug 02 '24 23:08 thsbrown