bash 终端无法运行 apktool

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/21656721/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-18 09:31:17  来源:igfitidea点击:

Terminal can't run apktool

javaandroidbashapk

提问by user3289129

I am using macOSX, and trying to extract all the files in a APK file, I've extracted it with zip and unzip. Used dex2jar to extract classes.dex to jar file and decompiled it.

我正在使用 macOSX,并尝试提取 APK 文件中的所有文件,我已使用 zip 和解压缩将其解压缩。使用 dex2jar 将 classes.dex 提取到 jar 文件并反编译它。

Now when I am in my last step, using APKtool to decode the apk file, however, it shows "-bash: apktool: command not found " eventhough I put all 3 files(aapt, apktool and apktool.jar) into one folder.

现在,当我进行最后一步时,使用 APKtool 解码 apk 文件,但它显示“-bash:apktool:未找到命令”,即使我将所有 3 个文件(aapt、apktool 和 apktool.jar)放入一个文件夹中。

How can I decompile with my apktool now?

我现在如何用我的 apktool 反编译?

回答by flagoworld

If you are using relative paths to execute apktool, and you are cdd to the directory they are in, you have to prefix the command with ./

如果您使用相对路径来执行 apktool,并且您是cdd 到它们所在的目录,则必须在命令前加上./

So if apktool is at /path/to/apktool

所以如果 apktool 在 /path/to/apktool

And you cd /path/to

和你 cd /path/to

Then type ./apktool

然后输入 ./apktool

Instead of apktool

代替 apktool



If you want to add this folder to your PATH, you can do that too...

如果您想将此文件夹添加到您的 PATH,您也可以这样做...

Open ~/.bashrcin a text editor of choice and add this to the bottom of it:

~/.bashrc在选择的文本编辑器中打开并将其添加到它的底部:

PATH=$PATH:/path/to

PATH=$PATH:/path/to

Where, once again, /path/tois the folder that contains apktool.

再一次,/path/to包含apktool.

Now you can just type apktoolfrom anywhere.

现在您可以apktool从任何地方输入。