2
\$\begingroup\$

I have a project with several *Dependencies.xml files which the Unity Jar Resolver resolves fetching the .aar files and storing them on Plugins/Android.

When installing Ironsource, I saw in the documentation that it says to add the dependencies to the mainTemplate.gradle file:

dependencies {
    // Your other dependencies //
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.google.android.gms:play-services-ads-identifier:16.0.0'
    compile 'com.android.support:support-v4:27.1.1'
    **DEPS**
     // Your other dependencies //
     // ... //
     // AdMob's dependency //
    compile 'com.google.android.gms:play-services-ads:17.1.1'
}

Because one of my dependencies that the jar resolver imports is an older version of support-v4 my build fails.

Seeing this new alternative, can I move all the dependencies files to the gradle file and let Gradle auto resolve this problem on the post build process?

Is there any pros/cons that the jar resolver has that Gradle doesn't? For what I know the Jar Resolver uses gradle.

\$\endgroup\$
1
\$\begingroup\$

The section you have here is ironSource telling you how to get Google Mobile Ads implemented in Unity. They seem to be behind the times, because Google’s recommended way of doing this is using the Jar resolver instead. I don’t think any of the stuff listed there is actually necessary. That is, you shouldn’t need to create a custom Gradle template just for this if you’re already getting the Google Mobile Ads SDK the Right Way (i.e. import the AdMob unity package which uses the Jar resolver).

Assuming you are, you should probably make sure that the versions in your google mobile ads dependency xml file matches up with ironSource’s required versions. That is, version 17.1.1 or earlier, apparently. Also, tell ironSource to stop requiring old versions of SDKs to function.

Edit: Switching to use the Gradle file exclusively is certainly an option, if you want to do that for every android library manually which otherwise gives you instructions to use the jar resolver, keeping in mind that you’ll need to redo it whenever you update the libraries.

\$\endgroup\$
  • \$\begingroup\$ Yes, but my question doesn't come from Ironsource request, but from the fact that if you nest all the requirements on the gradle file, the dependencies are downloaded AFTER the gradle project is built. It would help with Unity's library merging problem. Wouldn't it be better to use this second alternative? It would also make the repos' size smaller. \$\endgroup\$ – Javier Bullrich Mar 13 at 14:00
  • \$\begingroup\$ See my edit for an answer \$\endgroup\$ – Ed Marty Mar 13 at 14:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.