Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin conflict with mapbox and Google Firebase #646

Open
aniall-8 opened this issue Apr 3, 2018 · 26 comments
Open

Plugin conflict with mapbox and Google Firebase #646

aniall-8 opened this issue Apr 3, 2018 · 26 comments
Assignees
Labels
Milestone

Comments

@aniall-8
Copy link

aniall-8 commented Apr 3, 2018

  • 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

@jordy-isaac jordy-isaac self-assigned this Apr 3, 2018
@jordy-isaac
Copy link
Contributor

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?

@aniall-8
Copy link
Author

aniall-8 commented Apr 3, 2018

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

@wilhelmberg
Copy link
Contributor

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

@aniall-8
Copy link
Author

aniall-8 commented Apr 3, 2018

@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

@jordy-isaac
Copy link
Contributor

@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!

@wilhelmberg
Copy link
Contributor

@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

@aniall-8
Copy link
Author

aniall-8 commented Apr 3, 2018

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

@wilhelmberg
Copy link
Contributor

@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.

@aniall-8
Copy link
Author

aniall-8 commented Apr 3, 2018

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

@wilhelmberg
Copy link
Contributor

I owe you a beer

🍺 😄

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

@MiroMuse MiroMuse added this to the S18.2.1 milestone Apr 4, 2018
@jordy-isaac jordy-isaac self-assigned this Apr 12, 2018
@wilhelmberg
Copy link
Contributor

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

@Thaina
Copy link

Thaina commented Oct 13, 2018

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

@edmundham
Copy link

Got same issue on Unity 2019.1.0f2 and Mapbox SDK with Firebase auth, and #646 (comment) works to me, thanks!

@jeffries7
Copy link

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.

@steve6t6
Copy link

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?

@spaskhalov
Copy link

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

@steve6t6
Copy link

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

@spaskhalov
Copy link

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

@steve6t6
Copy link

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
Copy link

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 (#1438 (comment))
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.

@sherlore
Copy link

@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.

@rozx
Copy link

rozx commented Oct 29, 2019

@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.

@AgrMayank
Copy link

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

@sherlore
Copy link

sherlore commented Apr 19, 2020 via email

@fareedTahir131
Copy link

4. aar

Thanks, It worked for me.

@Antzy
Copy link

Antzy commented Nov 24, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests