Hi,
I am trying to implement Unity Mediation in my Android Studio project but when I add the dependencies according to Unity documentation and start syncing, the Unity dependencies couldn’t sync which prevents me to initialize Unity Mediation SDK in my app.
Are you exporting an Android Studio from Unity or starting in Android Studio?
The screenshot for the build.gradle you provided is the root build.gradle. The buildscript section is used for gradle build tools. What you want to do is remove the jfrog definition from the buildscript section and create a new section called allprojects. The allprojects section is usually in an android studio project by default.
If starting directly from Android Studio, your project gradles should look roughly similar to this:
My project is started in Android Studio but never found the “allprojects” section in my project. By manually adding the “allprojects” section it gives me this error and won’t let me sync
Anecdotally, it seems the way to get around this (and use our documented method of repository management) is to remove the dependencyResolutionManagement from settings.gradle if you have it.
If you don’t want to change that^, you could follow along the instructions in the guides I pasted above. I will reach out to our documentation team to include a section on this new method of dependency management and get back to you ASAP.
Thanks for your solution, it worked (kind of). After moving my jfrog from “build.gradle” to “settings.gradle” the gradle synced and now I am able to import the UnityMediation class to my project but there’s a warning from Adcolony adapter
[Processor] Library ‘C:\Users\wasee.gradle\caches\modules-2\files-2.1\com.adcolony\sdk\4.6.5\818fbdf875a91af407c3faa9bfea044f05101168\sdk-4.6.5.aar’ contains references to both AndroidX and old support library. This seems like the library is partially migrated. Jetifier will try to rewrite the library anyway
Should I ignore this warning or it needs to be fixed? If yes, I would like to know how.
And by the way, I didn’t understand this part of your message, can you explain?
Update on issue:
The gradle sync is now completely fine but when I run the app it gives me this error
Duplicate class com.google.protobuf.AbstractMessageLite found in modules jetified-protobuf-java-3.11.0 (com.google.protobuf:protobuf-java:3.11.0) and jetified-protobuf-javalite-3.17.2 (com.google.protobuf:protobuf-javalite:3.17.2)
I searched on the internet but couldn’t found a solution specific to my problem.
Here’s my Gradle Files
Glad you fixed the original issue! My suggestion was to remove the dependencyResolutionManagement block from settings.gradle, but it appears you can just as easily add your repositories to that as well.
Regarding the AdColony warning, I don’t think we’ve encountered it first-hand, but based on the message, it seems safe to ignore. Don’t take my word for that one. It may be better to see if others have encountered a similar warning in regards to AdColony.
Finally, regarding the protobuf library issue. This is a known issue that we will be addressing in our next release - 0.4.0 (which will be available within the next 3 weeks). I will update you in this thread when it is available.
Let me know if this helps. In the meantime, you may be able to try the suggested fixes above. Worst case, you’ll be able to pull in our change in a few weeks in order to use both Firebase and Unity Mediation together.
Thanks for all of the feedback. We will get the update out as soon as possible.
We have made the Android release for Mediation SDK 0.4.0. Please feel free to pull in the latest changes and let me know how things go in regards to the protobuf library conflict.