mapbox-unity-sdk
mapbox-unity-sdk copied to clipboard
ClassNotFoundException com.mapbox.android.unity.AndroidGps
Note: If this is a bug or support ticket, please provide the following information:
- Unity version: 2018.2.2f1
- Api Compatibility Level: 21
- Mapbox SDK version: v2.0.0
- Platform: Android
The error below occurring when I run the app on my android device, "java.lang.ClassNotFoundException: com.mapbox.android.unity.AndroidGps". Mapbox map not showing, and it just black. Please, I'm a newbie on this thing, need help from you guys! Thank u in advance

@bhaktiugp Could you try using the latest SDK version and see if you can reproduce the issue? Also, did you add the correct location permissions for your android export.
More details on how to reproduce the issue would be super helpful .
Trying to use "World-scale AR manual alignment" with android application, but faced same issue. Any help?
Same Problem here. If I add the Android Native location provider, the above class can't get loaded and the location is not updating
As a workaround to the problem I could get the classes loaded successfully if the minify options in the android player settings of unity are disabled. As soon as I enable Minify (set the checkbox for Release or Debug) the classes are not found anymore. I hope this get's fixed in a future version as of course we would prefer to use Minify and Mapbox makes this impossible.
Just letting you know I'm having the same issue. Thank you @janweigel for the workaroud. Seems to be working when turning off the minify options.
Here's the log:
07-19 13:30:44.411: I/Unity(9878): MemoryManager: Using 'Dynamic Heap' Allocator.
07-19 13:30:44.534: I/Unity(9878): SystemInfo CPU = ARM64 FP ASIMD AES, Cores = 8, Memory = 3783mb
07-19 13:30:44.534: I/Unity(9878): SystemInfo ARM big.LITTLE configuration: 4 big (mask: 0xf0), 4 little (mask: 0xf)
07-19 13:30:44.534: I/Unity(9878): ApplicationInfo [REDACTED]
07-19 13:30:44.534: I/Unity(9878): Built from '2019.4/staging' branch, Version '2019.4.22f1 (9fdda2fe27ad)', Build type 'Release', Scripting Backend 'mono', CPU 'armeabi-v7a', Stripping 'Disabled'
07-19 13:30:44.726: [REDACTED]
07-19 13:30:47.979: W/UnityMain(9878): type=1400 audit(0.0:1353870): avc: granted { read open } for path="/mnt/media_rw/FFFF-FFFF/Android/obb/[REDACTED]" dev="mmcblk1" ino=304 scontext=u:r:untrusted_app:s0:c222,c256,c512,c768 tcontext=u:object_r:vfat:s0 tclass=dir
07-19 13:31:44.853: I/Unity(9878): Allow Activation
07-19 13:31:44.853: I/Unity(9878): (Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 39)
07-19 13:31:45.342: I/Unity(9878): Android OS 9 / API-28 (HUAWEIANE-L21/9.1.0.368C432) => API version: 28
07-19 13:31:45.342: I/Unity(9878): (Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 39)
07-19 13:31:45.346: I/Unity(9878): LocationProviderFactory: Injected native Android DEVICE Location Provider - Mapbox.Unity.Location.DeviceLocationProviderAndroidNative
07-19 13:31:45.346: I/Unity(9878): (Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 39)
07-19 13:31:45.715: E/Unity(9878): AndroidJavaException: java.lang.ClassNotFoundException: com.mapbox.android.unity.AndroidGps
07-19 13:31:45.715: E/Unity(9878): java.lang.ClassNotFoundException: com.mapbox.android.unity.AndroidGps
07-19 13:31:45.715: E/Unity(9878): at java.lang.Class.classForName(Native Method)
07-19 13:31:45.715: E/Unity(9878): at java.lang.Class.forName(Class.java:453)
07-19 13:31:45.715: E/Unity(9878): at com.unity3d.player.UnityPlayer.nativeRender(Native Method)
07-19 13:31:45.715: E/Unity(9878): at com.unity3d.player.UnityPlayer.access$300(Unknown Source:0)
07-19 13:31:45.715: E/Unity(9878): at com.unity3d.player.UnityPlayer$e$1.handleMessage(Unknown Source:83)
07-19 13:31:45.715: E/Unity(9878): at android.os.Handler.dispatchMessage(Handler.java:108)
07-19 13:31:45.715: E/Unity(9878): at android.os.Looper.loop(Looper.java:216)
07-19 13:31:45.715: E/Unity(9878): at com.unity3d.player.UnityPlayer$e.run(Unknown Source:20)
07-19 13:31:45.715: E/Unity(9878): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.mapbox.android.unity.AndroidGps" on path: DexPathList[[zip file "/data/app/[REDACTED]-jBGSsvU44ETQ-JB0FwrCQw==/base.apk"],nativeLibraryDirectories=[/data/app/[REDACTED]-jBGSsvU44ETQ-JB0FwrCQw==/lib/arm, /data/app/[REDACTED]-jBGSsvU44ETQ-JB0FwrCQw==/base.apk!/lib/armeabi-v7a, /system/lib, /
07-19 13:31:46.453: E/Unity(9878): Error initializing telemetry: UnityEngine.AndroidJavaException: java.lang.ClassNotFoundException: com.mapbox.android.telemetry.MapboxTelemetry
07-19 13:31:46.453: E/Unity(9878): at UnityEngine.AndroidJNISafe.CheckException () [0x00096] in <0c28e1e730cf4a17bc80dd76531d408b>:0
07-19 13:31:46.453: E/Unity(9878): at UnityEngine.AndroidJNISafe.FindClass (System.String name) [0x0000c] in <0c28e1e730cf4a17bc80dd76531d408b>:0
07-19 13:31:46.453: E/Unity(9878): at UnityEngine.AndroidJavaObject._AndroidJavaObject (System.String className, System.Object[] args) [0x0002d] in <0c28e1e730cf4a17bc80dd76531d408b>:0
07-19 13:31:46.453: E/Unity(9878): at UnityEngine.AndroidJavaObject..ctor (System.String className, System.Object[] args) [0x00008] in <0c28e1e730cf4a17bc80dd76531d408b>:0
07-19 13:31:46.453: E/Unity(9878): at Mapbox.Unity.Telemetry.TelemetryAndroid.Initialize (System.String accessToken) [0x0004e] in <567921b59bc5468581d0b9adac189027>:0
07-19 13:31:46.453: E/Unity(9878): at Mapbox.Unity.MapboxAccess.ConfigureTelemetry () [0x0000b] in <567921b59bc5468581d0b9adac189027>:0
07-19 13:31:46.453: E/Unity(9878): (Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 39)