Unity Jar Resolver
Many Unity plugins have dependencies upon Android specific libraries, iOS CocoaPods, and sometimes have transitive dependencies upon other Unity plugins. This causes the following problems:
- Integrating platform specific (e.g Android and iOS) libraries within a Unity project can be complex and a burden on a Unity plugin maintainer.
- The process of resolving conflicting dependencies on platform-specific libraries is pushed to the developer attempting to use a Unity plugin. The developer trying to use your plugin is very likely to give up when faced with Android or iOS-specific build errors.
- The process of resolving conflicting Unity plugins (due to shared Unity plugin components) is pushed to the developer attempting to use your Unity plugin. In an effort to resolve conflicts, the developer will very likely attempt to resolve problems by deleting random files in your plugin, report bugs when that doesn't work and finally give up.
The Play Services Resolver plugin (the name comes from its origin of just handling Google Play Services dependencies on Android) provides solutions for each of these problems.
Using With Android Native
Android Native is shipped with all required libraries inside. We should also say that all those libraries will remain disabled until you enable the API that requires a specific library to be installed as part of a build.
Long story short, you do not have to use the Unity jar resolver with Android Native plugin. However, from the previous chapter, you already understand how convenient it may be for the unity android development in general.
Once you enabled jar resolver support inside the Android Native plugin setting it will uninstall all libraries it shipped with and will only generate dependencies for the jar resolver to resolve. The generate dependencies are located inside the AN_Dependencies.xml file if any. Otherwise, the dependencies file will not be created at all.
Once you are ready to start using a Unity Jar Resolver addon, just enable resolver support inside the plugin settings tab. As you may already know ANP will updates / generates required resources with build pre-processes if need. But you may trigger resources update by hiting the "Start API Resolvers" button. See the screenshot below.
The jar resolver is the third-party solution under a MIT license. So if you going to use it, you should be aware of it. I will be adding here user reports/solutions due to using Jar resolver in the project.
Xcode Linker error
Resolver generates an *.xcworkspace project file for XCode, if you'll use the default project file, you will get a linker error.
Multiple Dex Files Error
This is one of most common error developers will face when building for Android and having multiple 3-rd party plugins installed int a project. The error description will give you the name of the duplicated library or program.
The error would look similar to :
D8: Program type already present: <lib_name>
Unfortunately, I can't give guidelines on how to avoid or how to solve it since it is completely unrelated to Stan's Assets plugins. However, in most cases, it can be solver fairly simple when using a jar resolver.
Analyze Assets/Plugins/Android folder content.
The folder will contain *.aar files and it also may contain lib project - I personally do not recommend to keep lib project under that folder since it creates confusion. But you can't always control the way external plugins are placing the resources.
To give you an idea, here is how the lib project would look like
Your goal is to determine if this lib project is really necessary. For example, in this case, I can say that Firebase lib project is required since it will contain my project settings inside.
Try to remove everything from that folder except things that aren't just simple libraries. Then run Force Resolve
If that will not help, try to locate duplicates in your project. For example, If you already have aar lib inside that folder with name: com.android.support.support-v4-27.1.1
Make sure that there is no other Android support aar, jar or library it not necessarily will be named the same way, could be something like com.android.support.support-v4, support-v4, android_support_v4, etc.
I hope this small section will help you successfully resolve your Dex issue.