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

Plugin conflict with mapbox and Google Firebase

Open aniall-8 opened this issue 7 years ago β€’ 26 comments

  • Unity version: 2017.3.0f1
  • Mapbox SDK version: 1.4.0
  • The platform you're building to: Android
  • A description of what you're trying to do: Just a simple variation of the Location Provider
  • Steps to recreate the bug if appropriate:
  • Links to your logs are also helpful: https://pastebin.com/7H8A4p9G

I'll start off by saying that I have the ARcore sdk installed in my project.

So I've found that if I have both the mapbox sdk and any firebase sdk installed in the same project it refuses to build outright, giving me the error shown here: "Multiple dex files define Landroid/support/compat/BuildConfig". Is there a stripped down version of the sdk I can use? My project is for college and I'm really running out of time. All I need is something that shows the users location on a map while I track the distance they have walked in the session but I need to store that information in firebase. It looks to me like a plugin conflict

Thanks, Niall

aniall-8 avatar Apr 03 '18 14:04 aniall-8

Hi @aniall-8. Would you mind letting us know what device you're building to and providing a screenshot of your settings? Also, have you tried updating Unity to 2017.3?

jordy-isaac avatar Apr 03 '18 14:04 jordy-isaac

I'm using a samsung s8. What settings specifically do you need to see? I'l provide everything I can.

I haven't tried updating unity, I was advised not to as I'm quite far into the project, do you think it would be safe to try? My project is for my final year in college and I've 2 weeks to complete it, if I badly mess up the project it could potentially wreck my whole degree..So I'm kinda scared to but I will try if it means it'll fix the problem.

I've tried an older version of the mapbox sdk too and I got the same error. I noticed the new sdk has lots of AR stuff in it so I tried removing all of that from the import but it didn't help. I also tried to find that extra Build.Config file so I could remove it but couldn't locate it.

As soon as I delete the Mapbox folder in the project or the Firebase one the error disappears and it builds without issue.

Thanks so much for helping

aniall-8 avatar Apr 03 '18 14:04 aniall-8

I'll start off by saying that I have the ARcore sdk installed in my project.

@aniall-8 if you already have ARCore in your project don't need any of the Mapbox AR stuff, you are free to delete (or not import) the AR related folders.

These are: image

wilhelmberg avatar Apr 03 '18 15:04 wilhelmberg

@BergWerkGIS I tried that last night but the error persisted unfortunately, thanks though. Literally all I need is a simple map displaying the players position while they go on a short walk

aniall-8 avatar Apr 03 '18 15:04 aniall-8

@aniall-8 Please make sure that your Android dev environment is up to date. I think the Unity version might be the best place to start. See here: https://developers.google.com/ar/develop/unity/quickstart

Install Unity 2017.3.0f2 or higher, with the Android Build Support component. For more info, see Downloading and Installing Unity.

Hope this helps!

jordy-isaac avatar Apr 03 '18 16:04 jordy-isaac

@aniall-8 I was able to reproduce your problem.

Please delete some of Android libraries in Assets/Mapbox/Core/Plugins/Android/ that it looks like this: image

wilhelmberg avatar Apr 03 '18 17:04 wilhelmberg

@BergWerkGIS That sounds promising. Did you fix the error?? Will I just delete that 'UniAndroidPermission' folder? I'm re-importing the mapbox sdk now

aniall-8 avatar Apr 03 '18 17:04 aniall-8

@aniall-8 I didn't fix anything and you don't need to re-import the Mapbox SDK.

If you look at the folder Assets/Mapbox/Core/Plugins/Android/ in your project you'll see more files than in the screenshot above.

Delete the additional files so that your folder looks the same as the screenshot above.

wilhelmberg avatar Apr 03 '18 17:04 wilhelmberg

I deleted all the files that started with 'support' and now I can build! Thank you so much, I owe you a beer

aniall-8 avatar Apr 03 '18 17:04 aniall-8

I owe you a beer

🍺 πŸ˜„

Going to leave this issue open as a reminder to update support-*-.aars.

wilhelmberg avatar Apr 03 '18 18:04 wilhelmberg

Going to leave this issue open as a reminder to update support-*-.aars.

wilhelmberg avatar Apr 18 '18 15:04 wilhelmberg

Could you please move location of those /mapbox/core/plugins? into top level /plugins ?

Thaina avatar Oct 13 '18 04:10 Thaina

Got same issue on Unity 2019.1.0f2 and Mapbox SDK with Firebase auth, and https://github.com/mapbox/mapbox-unity-sdk/issues/646#issuecomment-378325604 works to me, thanks!

edmundham avatar May 08 '19 21:05 edmundham

Deleting the duplicate Android libraries, all the ones name support, allows me to build. However, the map has now become very flaky. The apk will now randomly crash on different devices.

jeffries7 avatar Jul 16 '19 13:07 jeffries7

Sept 2019 - Cleaning up the Plugin folder as per BergWerkGIS suggest does allow us to push to Android devices, But now we are getting this error: Error initializing telemetry: UnityEngine.AndroidJavaException: java.lang.ClassNotFoundException: Didn't find class "com/mapbox/android/telemetry/MapboxTelemetry"

In the latest version of the MapBox plugin we don't see mapbox-android-telemetry in the plugins folder either?

steve6t6 avatar Sep 26 '19 10:09 steve6t6

I also ran into this problem. I can confirm that for FireBase.6.5.0 & MapBox.2.1.0 the working configuration of the libraries looks like this: image

spaskhalov avatar Sep 26 '19 11:09 spaskhalov

I also ran into this problem. I can confirm that for FireBase.6.5.0 & MapBox.2.1.0 the working configuration of the libraries looks like this:

Thanks for the quick reply πŸ‘ I used this configuration but I am still having an issue with : java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v4/content/ContextCompat

Also we are using FireBase.6.4.0 with MapBox.2.1.0

steve6t6 avatar Sep 26 '19 12:09 steve6t6

Try to do "Play service resolver / Android / Force Resolve" and then rebuild.

spaskhalov avatar Sep 26 '19 12:09 spaskhalov

Try to do "Play service resolver / Android / Force Resolve" and then rebuild.

No Joy, Same Fatal ExceptionLocationSettingsChangeThread

Also I am seeing a warning about conflicting dependencies in the Editor, Some conflicting dependencies were found. The following dependency versions were modified: com.android.support:appcompat-v7:24.0.+ --> androidx.appcompat:appcompat:1.0.0 com.android.support:support-v4:26.1.+ --> androidx.legacy:legacy-support-v4:1.0.0

steve6t6 avatar Sep 26 '19 12:09 steve6t6

I have now fixed this!

The problem: MapBox uses depreciated support libraries, the bundled plugins cause conflicts with AndroidX. Solution: Remove conflicting plugins, then fix the two important plugins below: Solution courtesy of Tasta (https://github.com/mapbox/mapbox-unity-sdk/issues/1438#issuecomment-531323621) but here is just a little more info on how to use this stuff.

  1. Get Jetifier Standalone from: https://developer.android.com/studio/command-line/jetifier
  2. Unzip it to somewhere.
  3. Open a command prompt and navigate it to your_folder_location/jefifier-standalone/bin
  4. Run this command on: Assets\Mapbox\Core\Plugins\Android/libtelemetry-full-release.aar jetifier-standalone -i <path_to_file.aar> -o <path_to_file.aar> This will correct dependancies and copy the new version over the old one.
  5. Now fix: Assets\Mapbox\Unity\Location\Plugins\Android/com.mapbox.android.unity-debug.aar
  6. Ensure Jetifier is active in Unity, Assets->PlayServicesResolver->AndroidResolver->Settings
  7. Profit!

This was working for us using MapBox.2.1.0 and FireBase.6.4.0.

steve6t6 avatar Sep 26 '19 14:09 steve6t6

@steve6t6 You are the hero of the world!!

Perfect solution working with MapBox2.1.0 & Firebase 6.6.0

Suffering for all day, thanks god the internet has you.

sherlore avatar Oct 14 '19 21:10 sherlore

@steve6t6 Thank you! That also works with MapBox 2.0.0 & play-games-plugin-for-unity 0.9.64! It broke my soul, gladly I found this.

rozx avatar Oct 29 '19 18:10 rozx

This helped a lot. Thanks!! Installing Mapbox with ARFoundation lead to this issue for me and I wasn't sure what to do.

AgrMayank avatar Jan 31 '20 15:01 AgrMayank

Hi Hans Schaa,

It is the full path of the target library. I have recorded a video as tutorial. Link: https://youtu.be/EoWLtLWcngM?t=276

I wish this could help you. Feel free to ask me any question.

Sincerely, Sherlore

Hans Schaa [email protected] ζ–Ό 2020εΉ΄4月19ζ—₯ ι€±ζ—₯ δΈ‹εˆ12:28ε―«ι“οΌš

Please help me, i dont understand this line

  1. Run this command on: Assets\Mapbox\Core\Plugins\Android/libtelemetry-full-release.aar jetifier-standalone -i <path_to_file.aar> -o <path_to_file.aar>

Which things i put in <path_to_file.aar>, i have the same problem whit Mapbox and firebase. :/

β€” You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/mapbox/mapbox-unity-sdk/issues/646#issuecomment-616027420, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE4ZPZZLRCVABXU7QYWLYVTRNJ4WLANCNFSM4EYUQ4FQ .

sherlore avatar Apr 19 '20 06:04 sherlore

4. aar

Thanks, It worked for me.

fareedTahir131 avatar Oct 25 '22 17:10 fareedTahir131

Tried @steve6t6 solution but didn't work for me. What worked was deleting all files in Assets\Mapbox\Core\Plugins\Android except: libcore-release.aar libtelemetry-full-release.aar okhttp-3.8.0.jar Also leave UniAndroidPermission as it is.

This is with Mapbox SDK v2.1.1, Firebase SDK v9.2.0 and Unity 2020.3.41f1.

Antzy avatar Nov 24 '22 13:11 Antzy