Questions tagged [smali]

Smali is the assembly language for the Android Dalvik Virtual Machine and is based on the Jasmin Java assembly language.

Smali is the assembly language for the Android Dalvik Virtual Machine and is based on the Jasmin Java assembly language.

Smali as an assembler takes ASCII descriptions of Dalvik Virtual Machine Classes, written in a simple assembler-like syntax using the Dalvik Virtual Machine instruction set. It converts them into binary .dex class files, suitable for incorporating into an Android Package file (.apk) for execution on an Android powered device.

Questions with this tag should be specifically relating to the Android OS including decompiling, recompiling, and modifying legitimate apks . Please do NOT ask how to "hack", pirate, or otherwise work around a legitimate copy protection or licensing scheme put in place by the original developer.

See also:

  1. Smali/Baksmali Project
  2. Dalvik Bytecode Reference
  3. Jasmin
285 questions
136
votes
6 answers

Decompile .smali files on an APK

I downloaded APK Manager that lets me unpack APK files. But it only unpacks it and doesn't decompile the .smali file to .java. Is it possible to decompile the .smali to .java?
BimoZX
  • 1,611
  • 2
  • 12
  • 15
73
votes
3 answers

What's the best way to learn Smali (and how/when to use Dalvik VM opcodes)?

I know Java, and learned C but never used it. I do not know any form of assembly, either for a virtual machine or a real one. What's the best way to learn how to hack Smali?
Ken Kinder
  • 12,654
  • 6
  • 50
  • 70
57
votes
2 answers

What is Smali Code Android

I am going to learn a little bit about Dalvik VM, dex and Smali. I have read about smali, but still cannot clearly understand where its place in chain of compilers. And what its purpose. Here some questions: As I know, dalvik as other Virtual…
user4598738
24
votes
2 answers

Convert .Java file to .Smali file

I reverse-engineered an Android application with APKTool and got .Smali files as source code output. I converted the .Smali files with an application to .Java files. I was able to successfully edit the .Java files but now I want to convert them back…
user3830316
18
votes
6 answers

How to debug smali code of an android application?

I have a working android application. of which i dont have a source code. I would like to debug a functionality of this application. I could successfully reverse engineer this application apk file using apktool -…
16
votes
1 answer

what's the difference between invoke-virtual and invoke-direct in android

It said that invoke-virtual is invoking the virtual method, while invoke-direct is the direct method. However I'm not clear what is "virtual method" and what is "direct method"? In other words, what kind of method invoking will be invoke-virtual and…
ytliu
  • 569
  • 1
  • 4
  • 12
14
votes
4 answers

modifying .smali files

I reverse engineered some android apks to add some instrumentation for functional testing. I want to know given an smali as following how can I add something like Log.e(TAG, "some descritpion", e); to each method in the .smali files. .class public…
P basak
  • 4,874
  • 11
  • 40
  • 63
13
votes
2 answers

What does ".line" mean in smali code syntax? (Android-Smali Code)

Please take a look at this question Decompiled smali code contains things like .line 3 or .line 7. I cannot understand what .line is supposed to be, please elaborate on the usage.
Behzad Gh
  • 325
  • 1
  • 2
  • 10
11
votes
1 answer

Print Smali values to logcat

In the example code below, how can I add a command to print the values of v0, v1 etc to logcat? const v1, 0x7f05002e iget-object v2, p0, Lcom/company/myapp/MainActivity;->d:Lcom/company/myapp/f; invoke-virtual {v2},…
Raz Razman
  • 391
  • 2
  • 3
  • 14
10
votes
1 answer

Direct .java to .smali conversion. Possible?

I'm working with baksmali/smali tools. But sometimes I need to compile .java class to .smali file. So I've to first compile it with Eclipse and second disassemble the .APK to a set of .smali files. Is it possible to directly compile .java into…
OGP
  • 950
  • 2
  • 11
  • 26
10
votes
2 answers

Differences between apktool and baksmali

As far as I know, both apktool and baksmali are able to produce smali code out of .apk (.dex) files, and apktool makes use of the dexlib2. They are both APK packing/unpacking tools But still I am not clear what are the main differences between…
Long
  • 1,482
  • 21
  • 33
10
votes
2 answers

How to set a boolean in smali

I have this line of code in smali :cond_2 sput-boolean v11, Lcom/geo/main/MainActivity;->mLARGE:Z I want to directly assigned a True value to v11 How do I do this?
bman
  • 3,740
  • 9
  • 34
  • 40
9
votes
3 answers

Changing the package name

I planned to change the package name through smali(reverse) when I open up apktool.yml, I saw this forced-package-id: '127' I have tried to change it but it crash why should i do?
Simon Ang
  • 113
  • 1
  • 1
  • 5
9
votes
3 answers

Is there apktool on Android? I want to assemble ".smali" and make new ".apk" in an Android application

I want to assemble ".smali" and make new ".apk" in an Android application. I don't have so much time to do this so I have to use some source code that already exists. There is an Apktool project which can build on Windows/Mac OS X/Linux, but I want…
Yin
  • 612
  • 7
  • 10
8
votes
1 answer

Is there any way to convert smali to java for editing and vice versa

I am currently modding an app.I am beginner till now.I want to ask is there any way to convert smali file to java for editing and vice versa. I searched the whole internet,even xda forum could not give me accurate answer. There are dozen of methods…
Shiraz Ahmad
  • 85
  • 1
  • 1
  • 8
1
2 3
18 19