How To Pack Resources Into Single AAR file

Overview

If you use Gradle build system to assemble your Unity Android application, you can not simply put the Android resources to Assets/Plugins/res/... You have to put all your resources into a single .aar file and link it to your project.

Tutorial

  1. Create an empty directory and go inside it.
  2. Create file AndroidManifest.xml inside directory with following content:

    1
    2
    <manifest>
    </manifest>
    
  3. Create directory res. Inside it create directory drawable.

  4. Put all the image resources to the res/drawable.
  5. Go back to the directory where AndroidManifest.xml is placed. Example structure of your directory:

    1
    2
    3
    4
    5
    ├─── AndroidManifest.xml
    └─── res
        └─── drawable
            ├─── my_drawable.png
            └─── my_drawable1.png
    
  6. Run the jar cvf getsocial_resources.aar -C . . inside directory.

Now your getsocial_resources.aar file is ready to be used.

Give us your feedback! Was this article helpful?

😀 🙁