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
Jetifier fails with Facebook SDK 7.17.2 #360
Comments
I have the same problem. |
Thanks for reaching out, can y'all do me a favor and verify that the issue occurs in in one of the Unity quickstarts (say the Auth one). Can you also verify whether you're using the gradle template. If you use the gradle resolution, you'll likely have the file You'll also need to have patching enabled: In this setup, you'll want to look at the
and you can prune dependencies here as a workaround. It would be helpful to know if you see the erroneous entries here. If you're not using this process (you see a bunch of Thanks for your help! |
@doom-goober I downloaded Facebook SDK 7.17.2 and I noticed that there are some loose AFAIK, newer Unity versions (not all) can patch those loose Let us know, |
https://documentation.onesignal.com/docs/troubleshooting-unity#section-android-x-compatibility Didn't try yet, but found possible fix on onesignal help section |
@gromilQaaaa Yeah thanks a lot, the OneSignal solution fixed the problem. :) |
This leads me to conclude that problem is the Jetifier is failing with a combo of Facebook and Unity. I opened this bug because I thought that the Jetifier in Unity was owned by the Unity Jar Resolver team. I apologize if I opened the bug in the wrong place. Who owns the Jetifier Process in Unity? Is that a Unity thing or a Google thing? Should I close this bug and file it somewhere else? Thanks! (Sorry for delay in response. My team is approaching a ship date.) |
I follow OneSignal solution to fix then can build successfully. But the apk size increase significantly. Is this due to androidx library size or something else? |
I agree my apk size has also increased by 8.8 MB. |
@chkuang-g @patm1987 Do you still need more info? This appears to be an interplay between Unity, how the resolver runs the Jetifier/AndroidX/Gradle, and the Facebook SDK. The workaround everyone has settled on (see the two comments above this one) is to enable the jetifier and androidX using a gradle script rather than through the resolver as per the instructions here: https://documentation.onesignal.com/docs/troubleshooting-unity#unity-20193-or-newer OneSignal explains what the issue is with this comment:
Please let me know if you need anything else and if I should be filing this bug somewhere more appropriate. Does Unity own this or does the Jar Resolver team own this? |
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: 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: 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. |
@mohamad-al-amaary @doom-goober Has your APK size also increased significantly with the latest Unity? |
I did not notice a difference @Russel1 - then again I did not test it fully compared to the OneSignal solution, though my solution seems more organic and my last build was 5mb bigger actually. |
I cannot thank you enough @mohamad-al-amaary, your advice works for me and has unblocked our progress! 👏 👏 👏 |
Thank you for offering the workaround for this issue. To summarize, Unity 2019.3+ changed its gradle build so that enabling Jetifier in
Instead, OneSignal recommended to create
We can investigate how to automate this process in EDM4U, or alternative way to solve this. We also welcome any pull request to solve this issue! |
@chkuang-g Easiest way to build now as I mentioned in my previous answer with latest 2019.3 is enabling and using gradleTemplate.properties and adding in So maybe automation would be making the "Use Jetifier" setting of EDM4U enable custom gradle properties in Unity and automatically add those in, but this feature is only available in 2019.3.9+ I think (definitely not sure but something like that) - for previous versions of 2019.3 I guess the OneSignal solution is the only way other than the dreadful export to Android Studio option (it's not so bad but hella time consuming if you wanna make a lot of builds and work within a team with testers and marketing builds etc.) |
Please fill in the following fields:
Unity editor version: 2019.3.0f6
External Dependency Manager version: 1.2.135.0
Source you installed EDM (from .unitypackage or Unity Package Manager): .unitypackage
Features in External Dependency Manager in use (Android Resolver, iOS Resolver, VersionHandler, etc.): Jetifier
Plugins SDK in use (Firebase, Admob, Facebook, etc.): Firebase, Facebook
Platform you are using the Unity editor on (Mac, Windows, or Linux): Windows
Platform you are targeting (iOS, Android, and/or desktop): Android
Scripting Runtime (Mono, and/or IL2CPP): Mono
Please describe the issue here:
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)
Other Notes: It appears the Unity Dependency Manager is failing to correctly Jetify the Facebook SDK. However, if you export the project and let Android Studio Jetify the project, everything works fine.
Please answer the following, if applicable:
What's the issue repro rate? (eg 100%, 1/5 etc)
100%
The text was updated successfully, but these errors were encountered: