修改Android .aar文件的内容/与.zip格式相互转换 [英] Modifying contents of Android .aar file / Converting to and from .zip format

查看:1061
本文介绍了修改Android .aar文件的内容/与.zip格式相互转换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我有一个.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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆