Version: 2019.4
Building and using plug-ins for Android
JAR plug-ins

AAR plug-ins and Android Libraries

Use Android Libraries to reuse components across multiple applications, or build variations of one app with the same core components. Android Libraries compile into Android Archive (AAR) files that can be used as a dependency
See in Glossary
for an Android app module.

AAR plug-ins

Android Archive (AAR) plug-insA set of code created outside of Unity that creates functionality in Unity. There are two kinds of plug-ins you can use in Unity: Managed plug-ins (managed .NET assemblies created with tools like Visual Studio) and Native plug-ins (platform-specific native code libraries). More info
See in Glossary
are bundles that include compiled Java and native (C/C++) code, resources, and an Android Manifest. The .aar file itself is a .zip archive which contains all of the Assets. For more details, see Android Developer documentation on creating an Android Library.

To add an AAR plug-in to your Project, copy the .aar file anywhere within the Assets/Plugins/Android/libs path, then select it in Unity to open the Import Settings in the InspectorA Unity window that displays information about the currently selected GameObject, asset or project settings, allowing you to inspect and edit the values. More info
See in Glossary
window. Enable the Android checkbox to mark this .aar file as compatible with Unity:

ARR plug-in import settings as displayed in the Inspector window
ARR plug-in import settings as displayed in the Inspector window

Android Library Projects

Android Library projects are similar to AAR plug-ins: they contain native and Java code, resources, and an Android Manifest. However, an Android Library is not a single archive file, but a directory with a special structure which contains all of the Assets. The easiest way to create an Android Library project is by creating a project of this type in Android Studio. For more details, see Android Developer documentation on creating an Android Library.

Unity treats any subfolder of Assets/Plugins/Android as a potential Android Library, and disables Asset importing from within these subfolders.

A subfolder is recognized as an Android Library if both these conditions are true:

  • It contains an AndroidManifest.xml file.
  • The project.properties file contains the string android.library=true.

For more details, see Android Studio documentation on the Library module.

Providing additional Android Assets and resources

If you need to add Assets to your Unity app that should be copied as they are into the output package, import them into the Assets/Plugins/Android/assets folder. These will be copied into the assets/ directory of your APKThe Android Package format output by Unity. An APK is automatically deployed to your device when you select File > Build & Run. More info
See in Glossary
, and you can access them by calling the getAssets() Android API from your Java code.



  • Content verified and updated for Unity 2019.3.
Building and using plug-ins for Android
JAR plug-ins
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961