修改 Android .aar 文件的内容/与 .zip 格式之间的转换 [英] Modifying contents of Android .aar file / Converting to and from .zip format
问题描述
所以我有一个 .aar 文件,里面有一个我需要从里面删除的文件.
So I have a .aar file which has a file I need to remove from inside it.
我在 mac 上运行并将扩展名从 .aar 更改为 .zip 并解压缩了 zip 文件.然后我从文件夹中删除了该文件,将其重新压缩为 .zip,然后尝试将扩展名从 .zip 更改回 .aar.
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.
问题是现在修改的 .aar 无法识别为 .aar 文件.它仍然被注册为 .zip,我不能再在我的项目中使用它.
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.
所以我的问题有两个:
1) 如何轻松修改 .aar 文件的内容以及2)你如何正确地转换为/从 .aar 和 .zip?
1) How can one easily modify the contents of a .aar file and 2) How do you properly convert to/from .aar and .zip?
推荐答案
假设您的当前目录中有 mylib.aar
,请尝试以下操作:
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/ .
这篇关于修改 Android .aar 文件的内容/与 .zip 格式之间的转换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!