为了特定的业务目的,我需要从apk文件中删除某个目录。例如删除lib/mips64 64。
此过程不允许我在任何文件操作之前解压缩apk (使用zip重新打包apk文件会使其损坏)。
我尝试了"aapt“命令,但是它没有在目录上工作,也没有找到任何其他的修饰符可以完成这项工作。
有什么想法吗?
后来,我发现在删除了所有文件之后,目录就会被删除。有点聪明:)
发布于 2018-08-13 12:56:33
可以使用以下命令从给定的APK中删除文件或文件夹(其中“META”是本例中的文件夹):
zip -d your.apk "META-INF/*"要确保文件/文件夹被删除,可以运行以下命令:
unzip -l your.apk在你的终端上会显示出这样的桌子。它不包含我删除的文件夹:
Length Date Time Name
--------- ---------- ----- ----
2284 08-13-2018 17:49 AndroidManifest.xml
916 08-13-2018 17:49 res/layout/activity_main.xml
3418 08-13-2018 17:49 res/mipmap-hdpi-v4/ic_launcher.png
4208 08-13-2018 17:49 res/mipmap-hdpi-v4/ic_launcher_round.png
2206 08-13-2018 17:49 res/mipmap-mdpi-v4/ic_launcher.png
2555 08-13-2018 17:49 res/mipmap-mdpi-v4/ic_launcher_round.png
4842 08-13-2018 17:49 res/mipmap-xhdpi-v4/ic_launcher.png
6114 08-13-2018 17:49 res/mipmap-xhdpi-v4/ic_launcher_round.png
7718 08-13-2018 17:49 res/mipmap-xxhdpi-v4/ic_launcher.png
10056 08-13-2018 17:49 res/mipmap-xxhdpi-v4/ic_launcher_round.png
10486 08-13-2018 17:49 res/mipmap-xxxhdpi-v4/ic_launcher.png
14696 08-13-2018 17:49 res/mipmap-xxxhdpi-v4/ic_launcher_round.png
2552 08-13-2018 17:49 resources.arsc
4716 08-13-2018 17:49 classes.dex
--------- -------
76767 14 fileshttps://stackoverflow.com/questions/47030278
复制相似问题