EzDevInfo.com

dex2jar

Tools to work with android .dex and java .class files

using java decompiler jd-gui and getting // INTERNAL ERROR //

I decompiled an apk file using dex2jar and opened the resulting jar file in jd-gui. I can view almost all of the code nicely but one section - the constants - displays only // INTERNAL ERROR // and nothing else. Is there a way to retrieve the constants?


Source: (StackOverflow)

Apk decompile error: d2j-dex2jar command not found

I try to get source code from an .apk

I followed the steps from right here Is there a way to get the source code from an APK file? but on Step 2.4 when I wrote on my cmd "dex2jar path> d2j-dex2jar classes.dex" I get

"'d2j-dex2jar' is not recognized as an internal or external command, operable program or batch files."

any solutions ?


Source: (StackOverflow)

Advertisements

How to extract java files from .apk file

Unfortunately I deleted my Android source code. Tried to get jar using dex2jar and baksmali and used jd-gui to get java source files using my .apk file. Yes I got the files but the problem I have is, in more places in the java file, the code is in byte format. Need to get that to readable format to get myself to move forward.


Source: (StackOverflow)

Extracted Apk file shows Internal error when opened the java file

I have Extracted the apk file using dex2jar,when i opened the java source files in the jd-gui (java decompiler) it's showing Internal Error.How to fix this issue.


Source: (StackOverflow)

is it possible to compile android .java source files produced jd-gui

I want to change some lines in smali file. I converted android's classes.dex to classes.jar by using dex2jar. then used jd-gui to see source files and saved them . from this I got .java files . after editing I want to recompile them to see the differences in resulting smali by recompiling it , convert jar to dex , atlast redecompile it see differences in smali is this possible?

I want to do like this because source code is easy to understand and doing edits than editing smali


Source: (StackOverflow)

Decoding APK Files in android [closed]

I tried to decode a published application from Google Play with its apk file by using dex2jar and apktool. I successfully manage to get its source code however, I am wondering why the hell I got this sets of codes(attached image)? I could not clearly get the package/s and the activity names of this app. I need it badly.

enter image description here

Is it because of encapsulation? How can I get the real code?


Source: (StackOverflow)

Source code from Apk using dex2jar getting error in command prompt

I have to extract source code from APK file. I had rename the apk file to zip file and use the command for dex2jar classes.dex to convert .dex file to jar. But in command prompt getting error like:

dex2jar is not an interanl or external command.

Downloaded dex2jar version.0.0.9 and extracted in new folder and extracted the new renamed APK file also in that folder. But I got stuck with that.


Source: (StackOverflow)

how to use jd-gui from command line in Ubuntu

I want to see code of apk. I used dex2jar to make jar file using command sh /dex2jar/dex2jar-0.0.9.15/d2j-dex2jar.sh /GoogleServicesFramework.apk

I have downloaded jd-gui jd-gui-0.3.3.linux.i686 . but don't know how to use it. Searched a lot on net, but everywhere information about how to install it, no single excample of how to use it.

So please tell how to use jd-gui after dex2jar from command line


Source: (StackOverflow)

Eclipse Android Imported existing projects Accidently replaced and project all gone

I updated the ADT and imported the projects. Unfortunately, I replaced the projects/folder. All of sudden, all the files in the folder became 0 bytes, including files in sub folders and all the current auto backups. Is there any other way to recover?and why this all 0bytes happened?

I had tested decompiling my apk from mobile with this and Differente decompilers. but, couldn't all the codes and obstucted codes. and most of the decompiler resulted errors.


Source: (StackOverflow)

error occurred while decompiling apk file to get xml

C:\Users\admin\Desktop\XML>java -jar apktool.jar d -s cute.apk
I: Copying raw classes.dex file...
I: Loading resource table...

Exception in thread "main" brut.androlib.AndrolibException: Could not decode arsc file
        at brut.androlib.res.decoder.ARSCDecoder.decode(ARSCDecoder.java:54)
        at brut.androlib.res.AndrolibResources.getResPackagesFromApk(AndrolibResources.java:540)
        at brut.androlib.res.AndrolibResources.loadMainPkg(AndrolibResources.java:76)
        at brut.androlib.res.AndrolibResources.getResTable(AndrolibResources.java:68)
        at brut.androlib.Androlib.getResTable(Androlib.java:51)
        at brut.androlib.ApkDecoder.getResTable(ApkDecoder.java:191)
        at brut.androlib.ApkDecoder.decode(ApkDecoder.java:116)
        at brut.apktool.Main.cmdDecode(Main.java:148)
        at brut.apktool.Main.main(Main.java:77)
Caused by: java.io.IOException: Expected: 0x001c0001, got: 0x00000000
        at brut.util.ExtDataInput.skipCheckInt(ExtDataInput.java:48)
        at brut.androlib.res.decoder.StringBlock.read(StringBlock.java:43)
        at brut.androlib.res.decoder.ARSCDecoder.readPackage(ARSCDecoder.java:100)
        at brut.androlib.res.decoder.ARSCDecoder.readTable(ARSCDecoder.java:81)
        at brut.androlib.res.decoder.ARSCDecoder.decode(ARSCDecoder.java:49)
        ... 8 more

the above code is the error occurred in cmd while decompiling apk to get xml filewhat is ARSCDecoder. please help to find


Source: (StackOverflow)

Recompile system app

Because I'm creating a custom ROM I want to remove some entries from the settings.apk Because there is no way to hide a preference with XML I have to change the source code from the apk and have to delete the preference from the PreferenceScreen. So I decompiled the classes.dex with dex2jar copied the source code and add the following line:

getPreferenceScreen().removePreference(findPreference("toggle_wifi"));

Now my problem is that I do not know how to recompile the app. I can't compile it wit Eclipse because it uses some system namespaces (in Eclipse it is an error so I can't compile) How can I recompile the app? I only have the *.java files.

EDIT: The smali code I added to the smali files:

invoke-virtual {p0}, Lcom/android/settings/WirelessSettings;->getPreferenceScreen()Landroid/preference/PreferenceScreen;
move-result-object v12
const-string v13, "toggle_wifi"
invoke-virtual {p0, v13}, Lcom/android/settings/WirelessSettings;->findPreference(Ljava/lang/CharSequence;)Landroid/preference/Preference;
move-result-object v13
invoke-virtual {v12, v13}, Landroid/preference/PreferenceScreen;->removePreference(Landroid/preference/Preference;)Z

invoke-virtual {p0}, Lcom/android/settings/WirelessSettings;->getPreferenceScreen()Landroid/preference/PreferenceScreen;
move-result-object v12
const-string v13, "wifi_settings"
invoke-virtual {p0, v13}, Lcom/android/settings/WirelessSettings;->findPreference(Ljava/lang/CharSequence;)Landroid/preference/Preference;
move-result-object v13
invoke-virtual {v12, v13}, Landroid/preference/PreferenceScreen;->removePreference(Landroid/preference/Preference;)Z

invoke-virtual {p0}, Lcom/android/settings/WirelessSettings;->getPreferenceScreen()Landroid/preference/PreferenceScreen;
move-result-object v12
const-string v13, "toggle_bluetooth"
invoke-virtual {p0, v13}, Lcom/android/settings/WirelessSettings;->findPreference(Ljava/lang/CharSequence;)Landroid/preference/Preference;
move-result-object v13
invoke-virtual {v12, v13}, Landroid/preference/PreferenceScreen;->removePreference(Landroid/preference/Preference;)Z

invoke-virtual {p0}, Lcom/android/settings/WirelessSettings;->getPreferenceScreen()Landroid/preference/PreferenceScreen;
move-result-object v12
const-string v13, "bt_settings"
invoke-virtual {p0, v13}, Lcom/android/settings/WirelessSettings;->findPreference(Ljava/lang/CharSequence;)Landroid/preference/Preference;
move-result-object v13
invoke-virtual {v12, v13}, Landroid/preference/PreferenceScreen;->removePreference(Landroid/preference/Preference;)Z

Source: (StackOverflow)

Writing output of dex2jar to other folder

I am trying to write a batch file that writes the classes-dex2jar.jar to some other folder. I tried the following:

d2j-dex2jar %arg1% -o %arg2%

Here, arg1 is the path to classes.dex and arg2 is the folder where I wish to store the generated classes-dex2jar.jar file. (E:\new\)

Now, I am getting FileNotFoundException for the second argument. It says

java.io.FileNotFoundException: E:\new" (The filename, directory name,    
or volume label syntax is incorrect)
    at java.io.FileOutputStream.open(Native Method)
    at java.io.FileOutputStream.<init>(Unknown Source)
    at java.io.FileOutputStream.<init>(Unknown Source)
    at org.apache.commons.io.FileUtils.openOutputStream(FileUtils.java:77)
    at com.googlecode.dex2jar.v3.Dex2jar.to(Dex2jar.java:250)
    at com.googlecode.dex2jar.tools.Dex2jarCmd.doCommandLine(Dex2jarCmd.java
    :110)
    at com.googlecode.dex2jar.tools.BaseCmd.doMain(BaseCmd.java:174)
    at com.googlecode.dex2jar.tools.Dex2jarCmd.main(Dex2jarCmd.java:34)

Please tell me what am I doing wrong?


Source: (StackOverflow)

Decompiling and editing apk source

I was decompiling an apk source where i just decomplied the apk with dex2jar tool and then exported source with JD-gui. Now in source package i am getting multiple version of same file renamed with '$.java'. What are they and are they supposed to be merged?

files example content as given below,

MainScene.java

public class MainScreen implements Screen{
public MainScreen()
{}
..
}

MainScene$1.java

class MainScreen$2 implements Runnable{
MainScreen$2(MainScreen paramMainScreen)
{}
..
}

and so on...

So anyone know how to correctly view and edit all this file and re compile in eclipse OR is there any other way to do this? Thanks.


Source: (StackOverflow)

Using Android 5.1 hidden APIs w/ dex2jar.jar

I'm trying to create an app that uses some hidden Android libraries, but don't want to use reflection. I want to import the hidden libraries directly into my project so that they can be shared with my teammates, and so that if something on Android changes, our local copy won't change (until we change it, of course). I've seen many tutorials on how to do this, but I can't seem to get them to work. One such example I feel is pretty close, but I'm missing some crucial information to making it work:

For Lollipop the flow is little different:

  1. Get /system/framework/arm/boot.oat from lollipop device
  2. Use 'java -jar oat2dex.jar boot boot.oat'
  3. You will got 2 folders: dex and odex. Go to dex and make 'java -jar dex2jar.jar framework.dex'
  4. Rename resulting framework.jar to .zip, extract and find classes you need
  5. Go to [sdk_path]/platforms/[target_platform] and extract android.jar (first rename it to zip).
  6. Copy files from extracted framework to extracted android.jar. Then compress to zip and rename to .jar :)

Here, I was able to get all the way to step #3 before being stopped. There is a link in the original answer, but doesn't seem to include the dex2jar.jar file that the answer specifies. I've asked the author of the original question's answer for clarification on this, but I am still confused. Maybe I'm not understanding how to use this library? I checked the github page for that 'file' to try to find a guide or tutorial there, but I couldn't find anything relating to what I'm trying to do there either. I guess what I'm asking is, could somebody explain what to do to with the dex2jar source files to build what will eventually become dex2jar.jar so that I can follow step #3 above? Or, is there somewhere to download it that Google/Bing can't find?


Source: (StackOverflow)

Android decomplie strange problems

I have catch a strange problem about Android decomplie.
For research, I decomplie an Android apk by apktool and dex2jar, every thing seems ok, but when I use JD-GUI to open the decomplied .jar file, I cannot found any Android Activity class file in it, the interested was I saw the AndroidManifest.xml file which has wrote some activity path in it, and I promise I cannot found these classes file from those path, what's wrong with it? and how can do it?

--[Updated]--
I found that not only Activity class file not exists, but also some custom widget class file too, I saw some layout xml has used custom widget, but cannot found them real file. is there really in some way can hide the class file prevent others decompile?

enter image description here enter image description here


Source: (StackOverflow)