alamirfan
alamirfan

Reputation: 523

apktool is not recognised as an internal or external command

I got this error message

apktool is not recognised as an internal or external command, operable program or batch file

while doing the process provided in Is there a way to get the source code from an APK file?

How can I make it work?

Upvotes: 2

Views: 18844

Answers (5)

DInh
DInh

Reputation: 71

In apktool.bat, find

"%java_exe%" -jar -Duser.language=en -Dfile.encoding=UTF8 "%~dp0%BASENAME%%max%.jar" %fastCommand% %

and replace "%java_exe%" with the path to your java.exe. Example

"C:\Program Files\Java\jdk1.8.0_341\bin\java.exe" -jar -Duser.language=en -Dfile.encoding=UTF8 "%~dp0%BASENAME%%max%.jar" %fastCommand% %

Upvotes: 7

eternalodballl
eternalodballl

Reputation: 240

Faced similar issue , in my cause it was working earlier when i was using java runtime but after i switched to java development kit and pointed JAVA_HOME to jdk in environment variables it started showing me errors so what i did was edit apktool.bat and removed the function where it checks for java environment variables

Simply go to C://Windows (path could be different) look for file named as apktool.bat , open it with any editor and look for these lines

if defined JAVA_HOME (
set java_exe="%JAVA_HOME%\bin\java.exe"
)

either remove them or add # on starting of code like this

#if defined JAVA_HOME (
#set java_exe="%JAVA_HOME%\bin\java.exe"
#)

As an alternative you can also edit your environment variable and point JAVA_HOME to jre but by doing this programs that require devlopment kit won't work by default

Upvotes: 2

Adolph Randela
Adolph Randela

Reputation: 11

In my case when using windows.

Problem : The name of apktool had '.bat' or '.jar' extension and it would seem like its a jar file or its a .bat file

  • so my bat file was : 'apktool.bat.txt' and jar file was : 'apktool.jar.jar'

Solution : Windows hides the file extension, So i navigated to 'File Explorer Options' the set 'Hide file extensions for Known file types'.

Then make sure that files have correct file extension (i.e apktool.bat not apktool.bat.txt)

Apktool naming file extensions in windows

enter image description here

Upvotes: 1

whogiawho
whogiawho

Reputation: 466

This may be a PATH problem,do this:

PATH=%PATH%;ApkToolPath

ApkToolPath is the directory where apktool is.

BTW, u need to download 2 files: apktool-install-windows-r05-ibot.tar.bz2 and apktool1.5.2.tar.bz2. extract both and put aapt.exe apktoo.bat apktool.jar together.

Update: Download link for all the mentioned tools here

Good luck!

Upvotes: 5

user3121673
user3121673

Reputation:

Place aapt.exe, apktool.bat(extracted from apktool-install-windows-r05-ibot) and apktool.jar in same folder. That should solve your problem

Upvotes: 2

Related Questions