Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
U

unity-jar-resolver

> 包管理
Open source

Unity plugin which resolves Android & iOS dependencies and performs version management

1.5K stars0 likes0 views
WebsiteGitHub

About

Unity plugin which resolves Android & iOS dependencies and performs version management

External Dependency Manager for Unity

Overview

The External Dependency Manager for Unity (EDM4U) (formerly Play Services Resolver/Jar Resolver) is intended to be used by any Unity package or user that requires:

  • Android specific libraries (e.g AARs)

  • iOS CocoaPods, Swift Packages

  • Version management of transitive dependencies

  • Management of Package Manager (PM) Registries

If you want to add and use iOS/Android dependencies directly in your project, then you should to install EDM4U in your project.

If you are a package user and the plugin you are using depends on EDM4U, and the package does not include EDM4U as a package dependency already, then you should to install EDM4U in your project.

If you are a UPM package maintainer and your package requires EDM4U, then you should add EDM4U as a package dependency in your package manifest (package.json):

json
{
  "dependencies": {
    "com.google.external-dependency-manager": "1.2.178"
  }
}

You should still install EDM4U to test out the package during development.

If you are a legacy .unitypackage package maintainer and your package requires EDM4U, please ask the user to install EDM4U separately. You should install EDM4U to test out the package during development.

Updated releases are available on GitHub

Requirements

The Android Resolver and iOS Resolver components of the plugin only work with Unity version 4.6.8 or higher.

The Version Handler component only works with Unity 5.x or higher as it depends upon the PluginImporter UnityEditor API.

The Package Manager Resolver component only works with Unity 2018.4 or above, when scoped registry support was added to the Package Manager.

Getting Started

Check out troubleshooting if you need help.

Install via OpenUPM

EDM4U is available on OpenUPM:

bash
openupm add com.google.external-dependency-manager

Install via git URL

  1. Open Package Manager
  2. Click on the + icon on the top left corner of the "Package Manager" screen
  3. Click on "Install package from git url..."
  4. Paste: https://github.com/googlesamples/unity-jar-resolver.git?path=upm

Install via Google APIs for Unity

EDM4U is available both in UPM and legacy .unitypackage formats on Google APIs for Unity.

You may install the UPM version (.tgz) as a local UPM package.

You can also install EDM4U in your project as a .unitypackage. This is not recommended due to potential conflicts.

Conflict Resolution

For historical reasons, a package maintainer may choose to embed EDM4U in their package for ease of installation. This will create a conflict when you try to install EDM4U with the steps above, or with another package with embedded EDM4U. If your project imported a .unitypackage that has a copy of EDM4U embedded in it, you may safely delete it from your Assets folder. If your project depends on another UPM package with EDM4U, please reach out to the package maintainer and ask them to replace it with a dependency to this package. In the meantime, you can workaround the issue by copying the package to your Packages folder (to create an embedded package) and perform the steps yourself to avoid a dependency conflict.

Config file

To start adding dependencies to your project, copy and rename the SampleDependencies.xml file into your plugin and add the dependencies your project requires.

The XML file needs to be under an Editor directory and match the name *Dependencies.xml. For example, MyPlugin/Editor/MyPluginDependencies.xml.

Usages

Android Resolver

The Android Resolver copies specified dependencies from local or remote Maven repositories into the Unity project when a user selects Android as the build target in the Unity editor.

For example, to add the Google Play Games library (com.google.android.gms:play-services-games package) at version 9.8.0 to the set of a plugin's Android dependencies:

xml
<dependencies>
  <androidPackages>
    <androidPackage spec="com.google.android.gms:play-services-games:9.8.0">
      <androidSdkPackageIds>
        <androidSdkPackageId>extra-google-m2repository</androidSdkPackageId>
      </androidSdkPackageIds>
    </androidPackage>
  </androidPackages>
</dependencies>

The version specification (last component) supports:

  • Specific versions e.g 9.8.0

  • Partial matches e.g 9.8.+ would match 9.8.0, 9.8.1 etc. choosing the most recent version

  • Latest version using LATEST or +. We do not recommend using this unless you're 100% sure the library you depend upon will not break your Unity plugin in future

The above example specifies the dependency as a component of the Android SDK manager such that the Android SDK manager will be executed to install the package if it's not found. If your Android dependency is located on Maven central it's possible to specify the package simply using the androidPackage element:

xml
<dependencies>
  <androidPackages>
    <androidPackage spec="com.google.api-client:google-api-client-android:1.22.0" />
  </androidPackages>
</dependencies>

Auto-resolution

By default the Android Resolver automatically monitors the dependencies you have specified and the Plugins/Android folder of your Unity project. The resolution process runs when the specified dependencies are not present in your project.

The auto-resolution process can be disabled via the Assets > External Dependency Manager > Android Resolver > Settings menu.

Manual resolution can be performed using the following menu options:

  • Assets > External Dependency Manager > Android Resolver > Resolve

  • Assets > External Dependency Manager > Android Resolver > Force Resolve

Deleting libraries

Resolved packages are tracked via asset labels by the Android Resolver. They can easily be deleted using the Assets > External Dependency Manager > Android Resolver > Delete Resolved Libraries menu item.

Android Manifest Variable Processing

Some AAR files (for example play-services-measurement) contain variables that are processed by the Android Gradle plugin. Unfortunately, Unity does not perform the same processing when using Unity's Internal Build System, so the Android Resolver plugin handles known cases of this variable substitution by exploding the AAR into a folder and replacing ${applicationId} with the bundleID.

Disabling AAR explosion and therefore Android manifest processing can be done via the Assets > External Dependency Manager > Android Resolver > Settings menu. You may want to disable explosion of AARs if you're exporting a project to be built with Gradle/Android Studio.

ABI Stripping

Some AAR files contain native libraries (.so files) for each ABI supported by Android. Unfortunately, when targeting a single ABI (e.g x86), Unity does not strip native libraries for unused ABIs. To strip unused ABIs, the Android Resolver plugin explodes an AAR into a folder and removes unused ABIs to reduce the built APK size. Furthermore, if native libraries are not stripped from an APK (e.g you have a mix of Unity's x86 library and some armeabi-v7a libraries) Android may attempt to load the wrong library for the current runtime ABI completely breaking your plugin when targeting some architectures.

AAR explosion and therefore ABI stripping can be disabled via the Assets > External Dependency Manager > Android Resolver > Settings menu. You may want to disable explosion of AARs if you're exporting a project to be built with Gradle/Android Studio.

Resolution Strategies

By default the Android Resolver will use Gradle to download dependencies prior to integrating them into a Unity project. This works with Unity's internal build system and Gradle/Android Studio project export.

It's possible to change the resolution strategy via the Assets > External Dependency Manager > Android Resolver > Settings menu.

Download Artifacts with Gradle

Using the default resolution strategy, the Android resolver executes the following operations:

  • Remove the result of previous Android resolutions. E.g Delete all files and directories labeled with "gpsr" under Plugins/Android from the project.

  • Collect the set of Android dependencies (libraries) specified by a project's *Dependencies.xml files.

  • Run download_artifacts.gradle with Gradle to resolve conflicts and, if successful, download the set of resolved Android libraries (AARs, JARs).

  • Process each AAR/JAR so that it can be used with the currently selected Unity build system (e.g Internal vs. Gradle, Export vs. No Export). This involves patching each reference to applicationId in the AndroidManifest.xml with the project's bundle ID. This means resolution must be run again if the bundle ID has changed.

  • Move the processed AARs to Plugins/Android so they will be included when Unity invokes the Android build.

Integrate into mainTemplate.gradle

Unity 5.6 introduced support for customizing the build.gradle used to build Unity projects with Gradle. When the Patch mainTemplate.gradle setting is enabled, rather than downloading artifacts before the build, Android resolution results in the execution of the following operations:

  • Remove the result of previous Android resolutions. E.g Delete all files and directories labeled with "gpsr" under Plugins/Android from the project and remove sections delimited with // Android Resolver * Start and // Android Resolver * End lines.

  • Collect the set of Android dependencies (libraries) specified by a project's *Dependencies.xml files.

  • Rename any .srcaar files in the build to .aar and exclude them from being included directly by Unity in the Android build as mainTemplate.gradle will be patched to include them instead from their local maven repositories.

  • Inject the required Gradle repositories into mainTemplate.gradle at the line matching the pattern .*apply plugin: 'com\.android\.(application|library)'.* or the section starting at the line // Android Resolver Repos Start. If you want to control the injection point in the file, the section delimited by the lines // Android Resolver Repos Start and // Android Resolver Repos End should be placed in the global scope before the dependencies section.

  • Inject the required Android dependencies (libraries) into mainTemplate.gradle at the line matching the pattern ***DEPS*** or the section starting at the line // Android Resolver Dependencies Start. If you want to control the injection point in the file, the section delimited by the lines // Android Resolver Dependencies Start and // Android Resolver Dependencies End should be placed in the dependencies section.

  • Inject the packaging options logic, which excludes architecture specific libraries based upon the selected build target, into mainTemplate.gradle at the line matching the pattern android +{ or the section starting at the line // Android Resolver Exclusions Start. If you want to control the injection point in the file, the section delimited by the lines `// Android Resolver Exclu

Issues· 93 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

C#android-dependencyandroid-resolvercocoapodsios-resolver

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category包管理
PricingOpen source

> Related tools

N
npm
Node.js 默认包管理器
P
pnpm
高效节省磁盘的 Node 包管理器
I
is-gif
Check if a Buffer/Uint8Array is a GIF image