mapbox / mapbox-unity-sdk

Mapbox Unity SDK - https://www.mapbox.com/unity/
Other
721 stars 214 forks source link

Problem With Mapbox Android Files #1581

Open go2actasad opened 4 years ago

go2actasad commented 4 years ago

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

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)

horatiu665 commented 4 years ago

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

go2actasad commented 4 years ago

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

hashtagsheep commented 4 years ago

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

go2actasad commented 4 years ago

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 ?

hashtagsheep commented 4 years ago

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.

go2actasad commented 4 years ago

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.

thsbrown commented 1 month ago

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>