facebook / facebook-sdk-for-unity

The facebook sdk for unity.
https://developers.facebook.com/docs/unity
Other
490 stars 257 forks source link

Failing to build in Unity 2019.3.0f6 - Conflict with Firebase SDK - Duplicate dependencies #386

Open AAulicino opened 4 years ago

AAulicino commented 4 years ago

Checklist

Environment

Goals

Build the project

Expected Results

Project is successfully built

Actual Results

Project is failing to build with the following output:

CommandInvokationFailure: Gradle build failed. 
/Applications/Unity/Hub/Editor/2019.3.0f6/PlaybackEngines/AndroidPlayer/OpenJDK/bin/java -classpath "/Applications/Unity/Hub/Editor/2019.3.0f6/PlaybackEngines/AndroidPlayer/Tools/gradle/lib/gradle-launcher-6.1.1.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx4096m" "assembleRelease"

stderr[

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':launcher:checkReleaseDuplicateClasses'.
> 1 exception was raised by workers:
  java.lang.RuntimeException: Duplicate class android.support.v4.app.INotificationSideChannel found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.android.support:support-compat:27.0.2)
  Duplicate class android.support.v4.app.INotificationSideChannel$Stub found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.android.support:support-compat:27.0.2)
  Duplicate class android.support.v4.app.INotificationSideChannel$Stub$Proxy found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.android.support:support-compat:27.0.2)
  Duplicate class android.support.v4.os.IResultReceiver found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.android.support:support-compat:27.0.2)
  Duplicate class android.support.v4.os.IResultReceiver$Stub found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.android.support:support-compat:27.0.2)
  Duplicate class android.support.v4.os.IResultReceiver$Stub$Proxy found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.android.support:support-compat:27.0.2)
  Duplicate class android.support.v4.os.ResultReceiver found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.android.support:support-compat:27.0.2)
  Duplicate class android.support.v4.os.ResultReceiver$1 found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.android.support:support-compat:27.0.2)
  Duplicate class android.support.v4.os.ResultReceiver$MyResultReceiver found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.android.support:support-compat:27.0.2)
  Duplicate class android.support.v4.os.ResultReceiver$MyRunnable found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.android.support:support-compat:27.0.2)

  Go to the documentation to learn how to Fix dependency resolution errors.

Steps to Reproduce

  1. Create new unity 2019.3.0f6 project
  2. Set project build target to Android.
  3. Import Facebook SDK 7.18.0
  4. Import the latest Firebase Analytics SDK 6.10.0 into the project.
  5. Import Unity Jar Resolver v1.2.135 into the project.
  6. Enable mainTemplate.gradle (Player settings -> publishing settings -> check custom gradle template)
  7. Click Assets/Play Services Resolver/Android Resolver/Resolve
  8. Enable Jetifier when prompted
  9. Build the project

OR

  1. Download and open the repro project I made.
  2. Change build target to Android
  3. Build the project

Code Samples & Details

If I build with just Facebook SDK, it works. If I build with just Firebase SDK, it works. If I build with both Facebook SDK and Firebase SDK, it fails.

I made a Repro project following the steps I mentioned before. https://drive.google.com/file/d/1ngzavtEftODND1EpRyNchq3qClpyXl0C/view?usp=sharing

mcrvaz commented 4 years ago

HI @KylinChang , are there any updates on this?

We are not able to build the project on Unity 2019.3. On Android because of this issue, and on iOS, because of #359.

KylinChang commented 4 years ago

Hey @mcrvaz , can you try v7.18.1?

kashiftasneempro commented 4 years ago

Facing same issue with Facebook SDK v7.18.1 as well.

GunLengend commented 4 years ago

Facing the same issue with Facebook SDK v7.18.1. Our game can't build right now. Firebase or Facebook temporary disable.

hex commented 4 years ago

@kashiftasneempro did you delete the old plugin first?

kashiftasneempro commented 4 years ago

@kashiftasneempro did you delete the old plugin first?

Yes, I did.

ncinoadam commented 4 years ago

I am running into the same problem, has anyone make any progress on this? Seems like a androidx vs support library conflict?

ncinoadam commented 4 years ago

Actually: I haven't test this fully yet, but removing

implementation(name: 'com.android.support.support-compat-27.0.2', ext:'aar')

From build.gradle gets me building apk's again. Gonna do some testing to see if anything is broken though.

Update 1: Looks like things are working on my end, Facebook still works and i'm getting Firebase push token initialization correctly.

Update 2: I forgot to mention I also have to remove a line in the Firebase AndroidManifest file the one that is uses-sdk ... 14 When removing those two lines, everything is working great. i've been able to test everything related to my use cases. Hopefully this helps others.

kashiftasneempro commented 4 years ago

Actually: I haven't test this fully yet, but removing

implementation(name: 'com.android.support.support-compat-27.0.2', ext:'aar')

From build.gradle gets me building apk's again. Gonna do some testing to see if anything is broken though.

Update 1: Looks like things are working on my end, Facebook still works and i'm getting Firebase push token initialization correctly.

Update 2: I forgot to mention I also have to remove a line in the Firebase AndroidManifest file the one that is uses-sdk ... 14 When removing those two lines, everything is working great. i've been able to test everything related to my use cases. Hopefully this helps others.

Are you working in Unity?

Unity has mainTemplate.gradle not build.gradle.

ncinoadam commented 4 years ago

Yes this is Unity, instead of building the apk/aab from the editor, I export to Android Studio so I can work through dependencies. It helps a lot when debugging things like this.

mcrvaz commented 4 years ago

Hi @ncinoadam , which Firebase modules are you using? Just push notifications?

hex commented 4 years ago

@ncinoadam @kashiftasneempro I managed to solve this by enabling Jetifier and modifying the mainTemplate.gradle file like this:

dependencies {
    implementation 'androidx.multidex:multidex:2.0.0'
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    // Android Resolver Dependencies Start
    implementation 'androidx.appcompat:appcompat:1.0.0'
    // Facebook.Unity.Editor.AndroidSupportLibraryResolver.addSupportLibraryDependency
    implementation 'androidx.cardview:cardview:1.0.0'
    // Facebook.Unity.Editor.AndroidSupportLibraryResolver.addSupportLibraryDependency
    implementation 'androidx.cardview:cardview:1.0.0'
    // Facebook.Unity.Editor.AndroidSupportLibraryResolver.addSupportLibraryDependency
    implementation 'androidx.browser:browser:1.0.0'
    // Facebook.Unity.Editor.AndroidSupportLibraryResolver.addSupportLibraryDependency
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    // Assets/FacebookSDK/Plugins/Editor/Dependencies.xml:6
...
ncinoadam commented 4 years ago

Hi @ncinoadam , which Firebase modules are you using? Just push notifications?

I'm currently just using the Messaging module, but it wouldn't be hard to figure out the conflicts and fix them for others as well.

GunLengend commented 4 years ago

The problem can be solved by exporting project and build with Android Studio, then migrate with AndroidX by replacing almost old dependencies following @hex mentioned. But that it's not the way it supposed to be, the conflicts now go around package still using old dependencies while AndroidX is enabled after Force Resolve, so hope there is a fix available or official way to build without Exporting project.

highpockets commented 4 years ago

Actually: I haven't test this fully yet, but removing

implementation(name: 'com.android.support.support-compat-27.0.2', ext:'aar')

From build.gradle gets me building apk's again. Gonna do some testing to see if anything is broken though.

Update 1: Looks like things are working on my end, Facebook still works and i'm getting Firebase push token initialization correctly.

Update 2: I forgot to mention I also have to remove a line in the Firebase AndroidManifest file the one that is uses-sdk ... 14 When removing those two lines, everything is working great. i've been able to test everything related to my use cases. Hopefully this helps others.

Thanks @ncinoadam, this worked for me using the analytics module.

I agree with @GunLengend, it is a hack to have to mess with files in Android Studio and it should be handled inside Unity without the need to export every time you want build

EDIT: I also want to mention that this problem had nothing to do with the Facebook SDK as I don't have it in my project. I opened an issue here (https://github.com/firebase/quickstart-unity/issues/607) because I had pretty much the same Unity logs output and fixed the issue with what @ncinoadam mentioned, so this seems to be more of a Firebase thing

GunLengend commented 4 years ago

What I'm considering right now it's not only Facebook and Firebase issue, but also it can belong to Unity itself. Because enableJetifier and useAndroidX were enabled in Unity mainTemplate.gradle file but when Unity starts the build process, the Jetifier doesn't do its job, it should be migrating all old dependencies to force use AndroidX, but it isn't, and Android Studio can do that trick.

highpockets commented 4 years ago

What I'm considering right now it's not only Facebook and Firebase issue, but also it can belong to Unity itself. Because enableJetifier and useAndroidX were enabled in Unity mainTemplate.gradle file but when Unity starts the build process, the Jetifier doesn't do its job, it should be migrating all old dependencies to force use AndroidX, but it isn't, and Android Studio can do that trick.

After upgrading to the newest version of Unity, Facebook SDK, Firebase SDK all Android build issues have gone away. Now I'm battling with iOS in Xcode, but it is unrelated to this SDK.

EDIT: This could be because I had Firebase Analytics enabled previously and now I do not. I wasn't using Facebook SDK when I first got the issue, it was an issue with Mapbox SDK which and it seems they redistribute java libraries instead of updating to Android resolver. I got rid of Mapbox and started using Google maps, so good there, but then I introduced an older version of the Facebook SDK because the documentation of one of my assets requests the older version and I had multiple duplicate classes when introducing it. So I got the new Facebook SDK and I had to adjust the code in the asset that required the older version. Currently I just have Firebase Authentication working, but it still seems to be utilizing androidx.core.core-1.0.0 and that was where most of the duplicate classes were for me. Hopefully this helps

JabluszkoPL commented 4 years ago

I have same conflict when adding FB to my project where I have AdMob

Attribute application@appComponentFactory value=(android.support.v4.app.CoreComponentFactory) from [com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91

After adding suggested tools:replace="android:appComponentFactory" android:appComponentFactory="whateverString"

I am getting

java.lang.RuntimeException: Duplicate class android.support.customtabs.ICustomTabsCallback found in modules classes.jar (androidx.browser:browser:1.0.0) and classes.jar (com.android.support:customtabs:28.0.0)

And more ... I have newest versions of all SDKs and Unity.

highpockets commented 4 years ago

I don't know why you gave me a thumbs down and furthermore why I want to help you after doing so, but I suggest that you delete the com.android.support:customtabs:28.0.0, usually stored at Assets/Plugins/Android/ and see if that fixes your problem.

JabluszkoPL commented 4 years ago

Problem is that I am using mainTemplate.gradle instead of having tons of libs in Assets/Plugins/Android/ folder. (have limited space in repository). I did remove all implementation 'com.android.support.XXXX' from it and still have the same problem.

You got thumbs down because Your solution is not for me, When Admin is reading such post like yours, He can close this issue because he will assume that everything is done, when it is NOT. I am supporting lot of projects and solutions like: Export to Android Studio orremove library with is not existing in my project is not a solution.

highpockets commented 4 years ago

Good luck bud

doom-goober commented 4 years ago

What I'm considering right now it's not only Facebook and Firebase issue, but also it can belong to Unity itself. Because enableJetifier and useAndroidX were enabled in Unity mainTemplate.gradle file but when Unity starts the build process, the Jetifier doesn't do its job, it should be migrating all old dependencies to force use AndroidX, but it isn't, and Android Studio can do that trick.

The problem is both a Google/Unity problem and a Facebook problem. Facebook needs to upgrade their SDK to use AndroidX, pure and simple and this problem goes away. Google/Unity have developed their own version of Jetifier that runs within Unity to patch the problem until companies like Facebook fix it, but Unity's Jetifier doesn't work with the Facebook SDK!

Luckily, Android Studio's Jetifier works fine... and that's literally the only solution to running a Unity game with Facebook SDK and any other library that uses AndroidX.

LunarInteractiveArts commented 4 years ago

I had the same issue and switch to v7.19.2 from V7.16 which fixed the issue for me.

doom-goober commented 4 years ago

@LunarInteractiveArts I tried 7.19.2 but it didn't work, sadly. However, there's a solution posted on this bug: https://github.com/googlesamples/unity-jar-resolver/issues/360 that does work!

JabluszkoPL commented 4 years ago

@doom-goober I did try this and it not working or me. Code looks similar to this what Google dependencies resolver is generating: image

gromilQaaaa commented 4 years ago

Looks like I've found the fix in OneSignal help section. Fix is for Unity ofc. https://documentation.onesignal.com/docs/troubleshooting-unity#section-android-x-compatibility image

ruslanmamonov commented 4 years ago

I solved it in two steps for Unity 2019.3.11f1:

  1. Go to Edit->Project Settings->Player->Publishing settings->Tick Custom Properties Gradle Template
  2. Go to the newly generated gradleTemplate.properties and add these lines to the top:
    
    android.useAndroidX=true
    android.enableJetifier=true
jackatfp commented 4 years ago

In Unity 2019.2.21, the duplicate class errors are still there even with jetfiier enabled like below

([rootProject] + (rootProject.subprojects as List)).each { ext { it.setProperty("android.useAndroidX", true) it.setProperty("android.enableJetifier", true) } }

doom-goober commented 4 years ago

@jackatfp Did you try @gromilQaaaa 's solution? Here's a direct link to the section of the document that got my build working from Unity again: https://documentation.onesignal.com/docs/troubleshooting-unity#unity-20193-or-newer

It's the section where you have to add a file called Assets/Plugins/Android/settingsTemplate.gradle.

This problem frustrated me to no end and I was about resolve myself to building from Android Studio. Only this solution worked consistently for me (I thought the previous one worked but it stopped working for me when I added some other plugins back into my project.) And logically it made some sense: The gradle system was clearly not picking up the jetifier from Unity's post processor and settings but clearly the jetifier was working because it worked in Android Studio which uses gradle. So, a solution that's gradle based seems to make sense.

Anyways it worked for me and I was so annoyed and delighted to find a solution I hope it works for you. Please give it a try! Good luck.

mohamad-al-amaary commented 4 years ago

You're right that it wasn't picking up the jetifier in that case, but you don't need to use the OneSignal solution anymore.

Using newest 2019.3 official version (mine is 2019.3.12f1 atm) you can just use Custom Gradle Properties Template on top of the Main Gradle Template, and add: android.useAndroidX=true android.enableJetifier=true to the newly generated gradleTemplate.properties file.

I have been exporting to Android studio to build with all the SDKs my publisher wants and working through the miseries of Android build errors ever since, as a junior dev I think I encountered every issue, but now I can finally build from within Unity. Jetifier wasn't working with Facebook SDK properly except in Android studio, so if you used enough AndroidX migrated plugins it would be hard to build from within Unity without some hacky changes.

I also usually have to change Plugins/Android/AndroidManifest.xml to have this in application tag: tools:replace="android:appComponentFactory" android:appComponentFactory="leavemealone" also xmlns:tools="http://schemas.android.com/tools" in manifest tag

Yes, it's a random string as I'm not sure what the purpose of this is but it works and fixes my manifest merger build error, oh well.

I can now build with Ironsource (many adapters with it), Facebook SDK, GameAnalytics, Adjust, Firebase, whatever else. Basically just get latest Unity Jar Resolver, check settings remove auto resolve, remove resolve on build, set patch maintemplate and use jetifier to true, force resolve, add any extra dependencies/repos you want, do the gradleproperties trick, build within Unity, done.

jackatfp commented 4 years ago

@doom-goober yes, we tried everything include the solution you mentioned but still doesn't work

GunLengend commented 4 years ago

@doom-goober yes, we tried everything include the solution you mentioned but still doesn't work

Did you try the @ruslanmamonov option?

lucasmontec commented 4 years ago

This is also happening to me. I have tried all of the solutions above with no success. Facebook SDK is injecting old dependencies that clash with androidX and EDM4U is not able to solve them.

Example below: implementation 'com.android.support:appcompat-v7:25.3.1' // Facebook.Unity.Editor.AndroidSupportLibraryResolver.addSupportLibraryDependency implementation 'com.android.support:cardview-v7:25.3.1' // Facebook.Unity.Editor.AndroidSupportLibraryResolver.addSupportLibraryDependency implementation 'com.android.support:cardview-v7:26.0.2' // Assets/Packages/XXX.CustomerSupport/Helpshift/Editor/HelpshiftDependencies.xml:9

Facebook added cardview and another local plugin added it also. Jetifier seems to do nothing. The fix suggested by OneSignal also doesn't solve this issue.

killerloader commented 4 years ago

Yeah I've resorted to making my own custom version of the Facebook.Unity.Editor.dll so that it doesn't inject the conflicting implementations. But wow, it was not easy to build the facebook SDK... but worked out in the end :)

piotrros commented 4 years ago

I'm struggling with the same issue, however duplicated class is different:

java.lang.RuntimeException: Duplicate class androidx.vectordrawable.graphics.drawable.Animatable2Compat found in modules classes.jar (:vectordrawable-animated-1.0.0:) and classes.jar (androidx.vectordrawable:vectordrawable-animated:1.1.0)

Facebook doesn't seem to be importing this library.

I've tried jetifier tricks, I've tried creating mainTemplate.gradle, including androidx counterparts of legacy libraries, even including vectordrawable library, yet still I'm always getting the same error.

mainTemplate.gradle looks like this:

// Android Resolver Repos Start
([rootProject] + (rootProject.subprojects as List)).each {
    ext {
        it.setProperty("android.useAndroidX", true)
        it.setProperty("android.enableJetifier", true)
    }
}
([rootProject] + (rootProject.subprojects as List)).each { project ->
    project.repositories {
        def unityProjectPath = $/file:///**DIR_UNITYPROJECT**/$.replace("\\", "/")
        maven {
            url "https://maven.google.com"
        }
        maven {
            url (unityProjectPath + "/Assets/GeneratedLocalRepo/Firebase/m2repository") // Assets/Firebase/Editor/AnalyticsDependencies.xml:18, Assets/Firebase/Editor/AppDependencies.xml:22, Assets/Firebase/Editor/AuthDependencies.xml:20, Assets/Firebase/Editor/MessagingDependencies.xml:20
        }
        mavenLocal()
        jcenter()
        mavenCentral()
    }
}
// Android Resolver Repos End
apply plugin: 'com.android.library'
**APPLY_PLUGINS**
dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
// Android Resolver Dependencies Start
    //implementation 'com.android.support:appcompat-v7:25.3.1' // Facebook.Unity.Editor.AndroidSupportLibraryResolver.addSupportLibraryDependency
    //implementation 'com.android.support:cardview-v7:25.3.1' // Facebook.Unity.Editor.AndroidSupportLibraryResolver.addSupportLibraryDependency
    //implementation 'com.android.support:customtabs:25.3.1' // Facebook.Unity.Editor.AndroidSupportLibraryResolver.addSupportLibraryDependency
    //implementation 'com.android.support:support-v4:25.3.1' // Facebook.Unity.Editor.AndroidSupportLibraryResolver.addSupportLibraryDependency
    //implementation 'com.android.support:support-v4:27.1+' // Assets/Editor/VoxelBusters/NativePlugins/NPDependencies.xml:6

    implementation 'androidx.appcompat:appcompat:1.0.0'
    implementation 'androidx.cardview:cardview:1.0.0'
    implementation 'androidx.browser:browser:1.0.0'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'androidx.vectordrawable:vectordrawable-animated:1.0.0'

    implementation 'com.facebook.android:facebook-applinks:[8.0, 9)' // Assets/FacebookSDK/Plugins/Editor/Dependencies.xml:6
    implementation 'com.facebook.android:facebook-core:[8.0, 9)' // Assets/FacebookSDK/Plugins/Editor/Dependencies.xml:5
    implementation 'com.facebook.android:facebook-gamingservices:[8.0, 9)' // Assets/FacebookSDK/Plugins/Editor/Dependencies.xml:9
    implementation 'com.facebook.android:facebook-login:[8.0, 9)' // Assets/FacebookSDK/Plugins/Editor/Dependencies.xml:7
    implementation 'com.facebook.android:facebook-share:[8.0, 9)' // Assets/FacebookSDK/Plugins/Editor/Dependencies.xml:8
    implementation 'com.google.android.gms:play-services-base:17.4.0' // Assets/Firebase/Editor/AppDependencies.xml:17
    implementation 'com.google.firebase:firebase-analytics:17.5.0' // Assets/Firebase/Editor/MessagingDependencies.xml:15
    implementation 'com.google.firebase:firebase-analytics-unity:6.16.0' // Assets/Firebase/Editor/AnalyticsDependencies.xml:18
    implementation 'com.google.firebase:firebase-app-unity:6.16.0' // Assets/Firebase/Editor/AppDependencies.xml:22
    implementation 'com.google.firebase:firebase-auth:19.3.2' // Assets/Firebase/Editor/AuthDependencies.xml:13
    implementation 'com.google.firebase:firebase-auth-unity:6.16.0' // Assets/Firebase/Editor/AuthDependencies.xml:20
    implementation 'com.google.firebase:firebase-common:19.3.1' // Assets/Firebase/Editor/AppDependencies.xml:13
    implementation 'com.google.firebase:firebase-messaging:20.2.4' // Assets/Firebase/Editor/MessagingDependencies.xml:13
    implementation 'com.google.firebase:firebase-messaging-unity:6.16.0' // Assets/Firebase/Editor/MessagingDependencies.xml:20
    implementation 'com.parse.bolts:bolts-android:1.4.0' // Assets/FacebookSDK/Plugins/Editor/Dependencies.xml:4
// Android Resolver Dependencies End
**DEPS**}

// Android Resolver Exclusions Start
android {
  packagingOptions {
      exclude ('/lib/armeabi/*' + '*')
      exclude ('/lib/mips/*' + '*')
      exclude ('/lib/mips64/*' + '*')
      exclude ('/lib/x86/*' + '*')
      exclude ('/lib/x86_64/*' + '*')
  }
}
// Android Resolver Exclusions End
android {
    compileSdkVersion **APIVERSION**
    buildToolsVersion '**BUILDTOOLS**'

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    defaultConfig {
        minSdkVersion **MINSDKVERSION**
        targetSdkVersion **TARGETSDKVERSION**
        ndk {
            abiFilters **ABIFILTERS**
        }
        versionCode **VERSIONCODE**
        versionName '**VERSIONNAME**'
        consumerProguardFiles 'proguard-unity.txt'**USER_PROGUARD**
    }

    lintOptions {
        abortOnError false
    }

    aaptOptions {
        ignoreAssetsPattern = "!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~"
    }**PACKAGING_OPTIONS**
}**REPOSITORIES****SOURCE_BUILD_SETUP**
**EXTERNAL_SOURCES**

Other ideas what can be done? I've basically just added facebook sdk to my project and got this error right from the start.

I have latest jar resolver, facebook sdk and firebase sdk.

mohamad-al-amaary commented 4 years ago

I'm still using same method I suggested above (god bless gradle properties) and never had issues since, only things that have changed is that I stopped using Unity's Android SDK and downloaded it myself and changed the path to it in preference, to be able to set the target to api 30 a bit more peacefully. That shouldn't affect much though. Main thing is having EDM settings use jetifier, mainTemplate patching, and force resolving before you build (if you prefer not to have auto resolve on like me). In publishing settings I use custom gradle properties, main template, custom android manifest (i dont really touch main template or the android manifest anymore, I let them be filled by edm and facebook menu edit settings' "regenerate android manifest". If you get duplicate class error with all that being done, then you probably have extra ones in your project that you should remove. If using Adjust for instance you might resolve install referrer and still have another one in your project Plugins folder sitting there that u should delete, but yeah, most of the time if you use the settings I suggested all of these issues simply.. fade away.

TL;DR: Custom Gradle Properties Template, and add:

android.useAndroidX=true
android.enableJetifier=true

Custom Main Template, let EDM4U patch it, Jetifier on, Force resolve before build Custom Main Manifest, let Facebook Regenerate Manifest from its menu Edit Settings thingy, also make sure there are no errors there like PATH or whatever annoying thing facebook has I promise you you can build with a million sdks as I do daily, and I'm just a random junior game developer who went through this stuff a bit too much and resorted to Android Studio until custom gradle properties came out

piotrros commented 4 years ago

Okay, so finally I've found an issue - I had vectordrawable aar file floating around in files - this was causing the issue. Not sure which library copied it, but I've removed this file and all errors went away. Thanks for the hints anyway :)

Laur-Ivan commented 2 years ago

@mohamad-al-amaary Could you help me too? I have multiple SDKs implemented (admob, facebook, firebase, etc) and it all builds fine. But when I add a custom plugin (https://assetstore.unity.com/packages/tools/integration/android-install-referrer-179422) I get this error while building: https://pastebin.com/6eRHyi7a

LauraLaureus commented 2 years ago

Has somebody found a solution? I have reached to the same error, and while tracking down the issue looks like Firebase SDK uses a newer version of the InstallReferrer lib (2.2) while Facebook SDK stills uses 1.0.

I copy the dependecy tree I got from gradle for further reference imagen imagen

Lanceroyy commented 3 months ago

Same problem in 2024