Modifying contents of Android .aar file / Converting to and from .zip format

Solution 1:

Supposing you have mylib.aar in your current directory, try the following:

$ unzip myLib.aar -d tempFolder # or other extracting tool
# Change whatever you need
$ jar cvf myNewLib.aar -C tempFolder/ .

Solution 2:

For extracting following command you have to execute:

unzip myLib.aar -d tempFolder

Do all your changes in your extracted code and using below code you can again repackage it.

You have to move inside the extracted folder to again repackage it, using below code:

cd tempFolder

For repacking of aar file this way is working:

zip -r ../my-new-library.aar *

Above mentioned 3 steps were practically tested by me and its working properly.