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

Editing smali. Issue : Low 16 bits must be zeroed out. Is the hexadecimal id is wrong?

Good morning/afternoon/evening, I am quiet a newbie in smali language and, while compiling, there is an issue I can't solve. I hope this question has not been asked before, but I checked out Google and some threads on stackoverflow and couldn't find…
MisterX
  • 49
  • 3
  • 9
3
votes
2 answers

Redundant opcodes in Android dex

I'm looking into some Android performance issues at the moment and noticing some sub-optimal patterns in the dex code. I'm just wondering if anyone knows if this is to be expected, and what the rationale behind it might be. For example, consider the…
3
votes
1 answer

What are "ins" and "outs" in Dalvik bytecode?

In dex code (e.g., as produced by the dexdump tool), for each method definition I see "ins" and "outs" in addition to other metadata such as "registers", "insns size". I am instrumenting dex code to introduce new registers. The instrumentation is…
Saswat Anand
  • 358
  • 2
  • 10
3
votes
1 answer

how to modify smali code to delete 1 line in java code

I want to delete the 580th and 581th line in the java code below. this file is in system/framework/services.jar in android devices, so the steps I did are: decompile jar to smali change the smali file recompile the smali file to dex file pack it…
ChrisLv
  • 33
  • 1
  • 3
3
votes
2 answers

"smali" grammar specification | smali log injection

Is there any grammar specification available for smali code ? I am trying to play around with the smali code and one of the things that is missing me is the fact that some methods in smali have the .prologue section and some don't. Unfortunately the…
TheGT
  • 412
  • 8
  • 13
3
votes
2 answers

Is the .catchall used to indicate finally clause in smali for Dalvik byte code?

I noticed that when there is finally clause in the java code, there is always .catchall generated to identify the finally block or to inline it using the .catchall label, but I haven't found any online information about whether is the case or more…
monica
  • 1,035
  • 1
  • 9
  • 21
2
votes
1 answer

classes.dex generated by smali not working in .apk

I tried to generate a .apk from a classes.dex generated by samli. But I get these erros: Failure [INSTALL_FAILED_SHARED_USER_INCOMPATIBLE] (when I try to install the .apk on the emulator) Failure [INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES]…
FelixA
  • 127
  • 5
  • 14
2
votes
1 answer

how to locate the register problem in Android after modifying some smali code of an APK?

I would like to add something to an app, so I added some lines to a smali file (decompiled the apk using apktools) and then repackaged and ran it on a real device. It shows 10121 10211 E AndroidRuntime:…
jyxu2015
  • 23
  • 2
2
votes
1 answer

Load library in Smali

If you put the library along the path file.apk:/lib/(arm64-v8a|x86|etc.)/libsun.so then it can be loaded using the following code: const-string v0, "sun" invoke-static {v0}, Ljava/lang/System;->loadLibrary(Ljava/lang/String;)V How can I load a…
Noner
  • 21
  • 1
2
votes
1 answer

How to convert a byte array to hex string?

I have the following code: sget-object v5, Lkotlin/text/Charsets;->UTF_8:Ljava/nio/charset/Charset; invoke-static {v4, v2}, Ljava/util/Objects;->requireNonNull(Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/Object; invoke-virtual {v4, v5},…
azazazaza
  • 83
  • 1
  • 4
2
votes
1 answer

Is there a way to decompile multiple android apk at the same time?

I'm currently doing project that needs .smali file from android app. In order to get .smali file i have to decompile android app. Thus, someone recommends me to use apktool. Unfortunately, apktool only can decompile an android app at one time. I…
azizahn
  • 45
  • 9
2
votes
1 answer

(ART/DVM) Inserting an instruction just before the :try_end instruction results in VerifyError

I've been working with smali/baksmali for some time now, and I understand the instructions to a reasonable extent. Lately, I've encountered an error that is really weird. Inserting an instruction after the aligned try-catch block results in…
BluRe.CN
  • 311
  • 2
  • 11
2
votes
1 answer

Two questions regarding peculiar smali classes reversed from an apk using apktool

I asked this question on smali github, but this might be a way better place to ask it again. I have observed two cases of weird code decompilation which I wanted to ask about. The code is decompiled apk using apktool 2.4.1 on Windows 10 and both…
Andrej Mohar
  • 966
  • 8
  • 20
2
votes
1 answer

Edit smali file

I have a smali code that I want to add a log to. As I have no knowledge in smali, I need your help. The original Java code is: static HttpURLConnection createHttpURLConnection(String linkURL) { try { HttpURLConnection…
gilamran
  • 7,090
  • 4
  • 31
  • 50
2
votes
0 answers

How to make changes to a /system/framework files in an android SDK emulator (API > 25)?

I'm trying to make a few slight modifications to some /system/framework files in an Oreo SDK emulator (API 26). I want to make changes in the boot-framework.vdex file. I've managed to extract it via the vdexExtractor…
vovinio
  • 21
  • 2