14

i want to get source code from apk and use this solution Is there a way to get the source code from an APK file?

i try to dex file to jar and i used dex2jar; but cmd cannot recognize this command.

dex2jar classes.dex

"dex2jar is not recognized as an internal or external command"

is dex2jar deprecated?

what can i use to convert dex to jar?

Community
  • 1
  • 1
Anil Kocabiyik
  • 1,178
  • 6
  • 17
  • 47
  • It can't be deprecated, it was never part of the Windows OS. Are you running this from the same directory that `dex2jar.bat` is located? You can also access it via the absolute path, if you need to work in another directory. – A--C Feb 03 '13 at 23:47
  • 2
    i run dex2jar.bat classes.dex now at true directory, but the same error "dex2jar.bat is not recognized as an internal or external command..." – Anil Kocabiyik Feb 03 '13 at 23:57

10 Answers10

21

None of the above answers worked for me, I was able to get it working in the following way, There is no need of the classes.dex file. So follow the following instructions carefully:

  1. Download the latest version of dex2jar i was able to google it and get the latest one from sourceforge. just in case if you didnt get it http://sourceforge.net/projects/dex2jar/
  2. drop your apk file inside the dex2jar folder.

  3. open command prompt[win user] and navigate to that folder where you dropped the apk file.

  4. enter this command d2j-dex2jar.bat someApk.apk and you will get the jar file[read the jar file using jd-ui tool] for mac users refer this[point 4 in the link] for suitable terminal command http://sourceforge.net/p/dex2jar/wiki/UserGuide/

Muhammed Refaat
  • 8,914
  • 14
  • 83
  • 118
Aniruddha K.M
  • 7,361
  • 3
  • 43
  • 52
18

Use the command

d2j-dex2jar classes.dex

instead of

dex2jar classes.dex

Also make sure that u extracted the dex2jar file in the same folder as your apk source files kept in step 1 of given example.

Community
  • 1
  • 1
mpsbhat
  • 2,733
  • 12
  • 49
  • 105
7

If you are using dex2jar-2.x jar file than it is creating problem. Try to download dex2jar-0.0.9.15 jar file and then try that command.

Muhammed Refaat
  • 8,914
  • 14
  • 83
  • 118
Nikita
  • 193
  • 3
  • 10
1

Here are the steps I used:

  • unzipped both apk folder & dex2jar folder
  • Created a New Folder
  • Combined all apk & dex2jar files into the new folder
  • Opened command prompt & changed my directory pointing to the new folder name
  • in command prompt, I typed d2j-dex2jar classes.dex, Hit Enter
  • ....this created a new file in my new folder named classes-dex2jar.jar
ljdream00
  • 11
  • 1
1

I had the same problem and I have solved it, the file which you download from the GitHub isn't actually compiled so you would have to compile it first, rather than compiling, download this zip file from https://sourceforge.net/projects/dex2jar/files/dex2jar-2.0.zip/download and do the exact same process told(in the answer you are referring in your question) and you will get a jar file as your output. This file has already compiled all the resources for you so you wouldn't have to do this work manually!

Linux Geek
  • 957
  • 1
  • 11
  • 19
0

I had extracted both apk and dex in different folders. On copying the extracted files in the same folder and running dex2jar classex.dex it worked.

Adit Kabra
  • 1
  • 1
  • 1
  • 3
0

Even after all those answers if some people having problem go to folder

dex2jar-0.0.9.15\dex-tools\src\main\bin

here you have both the dex2jar.bat/sh and d2j-dex2jar.bat/sh files are present there.

move your classes.dex and use the any of those command.

Abhishek Gurjar
  • 7,426
  • 10
  • 37
  • 45
0

For me problem with the path, the correct path is C:\Users\username\Desktop\foldername\dex2jar>d2j-dex2jar classes.dex

MinnuKaAnae
  • 1,646
  • 3
  • 23
  • 35
0

I solved it by first downloading dex2jar-0.0.9.1 jar file and not the latest one. Then i used the following command d2j-dex2jar.bat classes.dex and make sure that you open the command window in the dex2jar-0.0.9.15 directory. A shortcut to open the cmd there is to open the directory and then press shift and right click anywhere inside the directory window. Then go to open command window here.

Haris Qurashi
  • 2,104
  • 1
  • 13
  • 28
knightcube
  • 139
  • 1
  • 13
0

1) Download dex2jar from this link and extract in your working directory.
2) In the extracted folder open command prompt and enter d2j-dex2jar ..\classes.dex.

You will get classes-dex2jar.jar in the current folder.

Suraksha Ajith
  • 872
  • 2
  • 12
  • 23