2

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?

Community
  • 1
  • 1
Irfan Alam
  • 476
  • 3
  • 9
  • 25

5 Answers5

7

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% %
tripleee
  • 175,061
  • 34
  • 275
  • 318
DInh
  • 71
  • 1
  • 2
5

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!

King of Masses
  • 18,405
  • 4
  • 60
  • 77
whogiawho
  • 466
  • 9
  • 21
  • I am new to this, can you explain where/how to do PATH=%PATH%;ApkToolPath – Irfan Alam Mar 30 '14 at 06:04
  • My path for apktool is c:\users\user\desktop\new folder [File name is "apktool1.5.2.tar"] – Irfan Alam Mar 30 '14 at 06:17
  • say dir c:\apktool containing "aapt.exe" and "apktool.bat", then do PATH=%PATH%;c:\apktool. besides, make sure u extract apktool.jar from apktool1.5.2.tar and put it to c:\apktool – whogiawho Mar 30 '14 at 06:24
  • I had only unzipped apktool1.5.2.tar.bz2 and apktool-install-windows-r05-ibot.tar.bz2 to that folder. I had not extracted apktool.jar from apktool1.5.2.tar and apktool-install-windows-r05-ibot folder from apktool-install-windows-r05-ibot.tar. Now I extracted those files again and put apktool.jar and aapt.exe and apktool.bat files in that same folder. Now it worked. THANK YOU. – Irfan Alam Mar 30 '14 at 06:55
  • Please simplify[edit] your answer. I will vote it up, So that any other have same problem will get benefit from it. – Irfan Alam Mar 30 '14 at 07:01
  • thanks man for the link to download. i was unable to find bat file for apktool – Deepak Vajpayee Jun 11 '19 at 05:53
2

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

1

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

zhangxaochen
  • 32,744
  • 15
  • 77
  • 108
1

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

Dang Max
  • 23
  • 7