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
8
votes
1 answer

Replace new method dexlib2 failing

I am using dexlib2 to rewriting existing apk through one jar utility. I want to change one instruction with my own instruction. It is basically returning some object and I want to replace it with another method which is returning different object.…
chikka.anddev
  • 9,569
  • 7
  • 38
  • 46
8
votes
3 answers

Reference vs. Precise Reference in Dalvik Verifier

I am writing instrumentation on Dalvik bytecode which performs some logging for various method call entries. Specifically, at various method call sites, I will insert a set of instructions which collects up the parameters, puts them in an Object[]…
Kristopher Micinski
  • 7,572
  • 3
  • 29
  • 34
8
votes
1 answer

Smali .local format

I disassembled an Android application with baksmali, and studied the produced smali code. One of the classes contains the following line: .local v1, "future":Lcom/android/volley/toolbox/RequestFuture;,…
user2340612
  • 10,053
  • 4
  • 41
  • 66
8
votes
1 answer

How does DalvikVM handle switch and try smali code

I am trying to learn smali and I have a few question that I couldn't find by googling them. 1) I created a simple test case to better explain myself const-string v1, "Start" :try_start_0 const-string v1, "Try Block" invoke-static {v1},…
Xonar
  • 1,296
  • 1
  • 14
  • 21
8
votes
5 answers

Automatic transformation of Android's dex code

I want to transform/instrument Dex files. The goals of transformation include measuring code coverage. Note that the source files are not available. So instrumenting Dex is the only option. I am wondering if there are any existing code base that I…
Saswat Anand
  • 358
  • 2
  • 10
7
votes
1 answer

apktool error while decompiling .apk

I got this error while I was decompiling an .apk by apktool. Although It doesn't appear for all apk files. Also I had installed these three frameworks: framework-res.apk SystemUI.apk twframework-res.apk I tried two different versions of…
ShayanKM
  • 551
  • 1
  • 7
  • 15
7
votes
1 answer

what is meaning of .prologue in a smali file?

I diassembled a simple android app using apktool and it generated some smali codes.other things are understandable but i am not getting the meaning of .prologue in the smali code.please help me Here other variables are self understanding linke…
Kme
  • 103
  • 1
  • 11
7
votes
1 answer

How does packed-switch work on Android as smali produced by apktool?

I'm trying to reverse engineer an apk with apktool d and the smali it produces contains packed-switch statements which I don't fully understand. A method contains: packed-switch v0, :pswitch_data_0 Followed later in the code with labels like…
Rob Pitt
  • 354
  • 3
  • 10
6
votes
1 answer

Why is this an invalid smali register?

I injected this piece of code invoke-static {p0}, Lcom/outfit7/talkingtomcandyrun/Toast;->show(Landroid/content/Context;)V in a decompiled app. Like this: .line 70 move-object/from16 v0, p0 iget-object v0, v0,…
dugof
  • 63
  • 1
  • 5
6
votes
3 answers

Waiting until last debugger command completes

When I debug smali with Smalidea on idea or Android Studio, I get a mistake say Smalidea throws an uncaught NullPointerException, and in the variables it says "Waiting until last debugger command completes", but 20 minutes later, nothing…
zhaotianyu
  • 71
  • 1
  • 3
5
votes
1 answer

injecting jar library into apk app

I'd like to inject a jar library into an apk file to use it from smali code. Here's what I did: Unpackaged the apk apktool d -f -r app-debug.apk Copied the jar file to the /libs directory of decompiled project Added the call to my library to the…
Ben
  • 3,989
  • 9
  • 48
  • 84
5
votes
1 answer

what does the .restart smali keyword do?

What does this line in smali do? I have been searching for the .restart thing on google and haven't been able to find any information about it. .restart local v3 #i:I
Notbad
  • 5,936
  • 12
  • 54
  • 100
5
votes
1 answer

smali structure of methods and classes

I have recently dug into some smali code and would love learning it. I have checked the dalvik bytecode reference but I couldn't find a structure reference as to when/how to use…
Aivan Monceller
  • 4,636
  • 10
  • 42
  • 69
5
votes
1 answer

How to generate call graph from android APK?

I have downloaded a few Android applications from Google Play. I have got Smali code through reverse engineering tool apktool .I want to generate call graphs for these applications. I have seen many links on stack overflow and Google, most of the…
Junaid
  • 1,668
  • 7
  • 30
  • 51
4
votes
2 answers

Increase local registers in Smali and use new register

Hi I am trying to understand how to properly increase the registers in a smali virtual method. In order to inject code which will use the new register For reference i have already read the following:…
Sevren
  • 301
  • 4
  • 10
1
2
3
18 19