So I have a .aar file which has a file I need to remove from inside it.
I am running on mac and changed the extention from .aar to .zip and unzipped the zip file. I then removed the file from the folder, recompressed it back into a .zip and then tried changing the extension from .zip back to .aar.
The problem is that the now modified .aar is not recognized as a .aar file. It is still being registered as a .zip and I can no longer use it in my project.
So my question is two fold:
1) How can one easily modify the contents of a .aar file and
2) How do you properly convert to/from .aar and .zip?
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/ .
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:
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.