Using in Native Android Projects

Quick overview on how to use in native android projects with unity as a library (UaaL)

Enable Main Gradle Template

  1. Open Unity Player Settings

  2. Go to Publishing Settings

  3. Enable Main Gradle Template

External Dependency Manager Setup

  1. Open Assets -> External Dependency Manager -> Android -> Settings

  2. Enable "Patch Main Gradle" and click Ok

  3. Open Assets -> External Dependency Manager -> Android -> Delete Resolved Libraries

  4. Open Assets -> External Dependency Manager -> Android -> Force Resolve

The above setup is required to avoid duplicate libraries when including unity as a library in your native projects. If you don't enable maingradle template, the libraries are resolved and embedded in the unityLibrary/libs folder leading to the issue.

After the above steps, follow this document on actions for Android Studio.