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
1
vote
0 answers

Smali: wide register index out of range

I'm modifying an apk and I have added code to close after comparing dates. I tried it in another application and it works perfectly. But I don't understand why it doesn't work with another apk. The application that gives me an error is made in…
ManPiC
  • 11
  • 2
1
vote
1 answer

register has type Long (High Half) but expected Long (Low Half)

I'm trying to fix a problem with Media Player seekTo() method which is called on a Forward/Rewind remote button press event, but I'm getting this error: with the following edited smali trying to convert long parameter to int: .method private static…
amarildo.xyz
  • 932
  • 1
  • 13
  • 21
1
vote
1 answer

java2smali 1.6 plugin does nothing

I'm trying to make java2smali 1.6 plugin https://plugins.jetbrains.com/plugin/7385-java2smali to work, but it does absolutely nothing. I have tried Android Studio 171.4443003 and 183.5692245 with gradle-2.3, 2.8 and 4.1. Also in IntelliJ IDEA…
arme
  • 11
  • 2
1
vote
1 answer

Convert .java to .smali

As mentioned in the title I am trying to convert a java file into a .smali file, so these are the commands I am trying to launch from Android studio terminal: javac HelloWorld.java dx --dex --output=classes.dex HelloWorld.class baksmali…
yosra
  • 702
  • 1
  • 11
  • 24
1
vote
1 answer

How to set a iput-object boolean to true in Smali?

I'm trying to edit a smali file of a decompiled Android APK I (legally) have. I can't figure out how to make this boolean be always true: .method public setValid(Ljava/lang/Boolean;)V .locals 0 .line 34 iput-object p1, p0,…
lol7344
  • 13
  • 1
  • 4
1
vote
2 answers

Alternate method to reversing than reading smali code?

I am reversing an android app. I want to modify and rebuild it. I used APK Studio (which is pretty much a GUI version of apktool) to get the files inside the apk. Now reading smali code is very difficult. I also tried to unzip it, get classes.dex,…
hp2505
  • 95
  • 2
  • 6
1
vote
1 answer

android smali editing: low bits must be zero

unable repack smali files error code:apktool invalid literal value low 16 bits must be zeroes out. which register value should i use in place of ""const/high16 v4""" with replaced value 0x7f04006a .line 11 move-object v3, v0 move-object v4,…
1
vote
1 answer

dexlib2 - Methodanalyzer resulting in UnresolvedClassException for certain classes

I am trying to instrument branches using dexlib2. However, since certain instructions only allow to use the local registers v0-v15 and my instrumentation requires one additional register, it is necessary to save the value of v0, use v0 for the…
auermich
  • 130
  • 10
1
vote
1 answer

How do i add a new resource identifier for a drawable in an app decompiled by apktool?

I'm trying to inject a imageview in to a decompiled apk's smali code. But the drawable used by the imageview needs it's own unique resource identifier. So far i have been unsuccessful in adding a new resource identifier without getting building …
Daniël Visser
  • 581
  • 3
  • 13
1
vote
1 answer

How to modify .line numbers in smali file?

I have used apktool to decompile an apk to its smali source. In all smali files there are .lineXYZ codes. They are random i.e .line 2 and somewhere next it would be like .line 33 so i am unable to get their sequence. I have created a line number…
Nadir
  • 87
  • 1
  • 13
1
vote
0 answers

smali, is any change, const/16 v0, 0x20 make v0 value -16

I have a smali code const/16 v0, 0x20 When I debug, I found after execute this line, the value of v0 is -16. Any change can this happen?
user3875388
  • 541
  • 1
  • 6
  • 19
1
vote
0 answers

Apktool - app instantly crashes after repackaging

In this instance I used this app: Perfect_Piano_v7.1.3_apkpure.com Apktool version: v2.3.3 IBotPeaches fork https://github.com/iBotPeaches/Apktool/releases/tag/v2.3.3 The original app works fine on my device and emulator, but after I unpack and…
Ben
  • 3,989
  • 9
  • 48
  • 84
1
vote
1 answer

Smali - how to to edit the url on click in this code

Following smali code viewing a url in webview by clicking a review button. But the link is followed by the PackageName in resultant url . So what should I change in the following smali code to go to the link only? .class final…
MD ELkurdi
  • 11
  • 2
1
vote
0 answers

How do I Log a String Referenced within a Method - Smali

I have been trying to reverse engineer an Android application and was wondering how I would go about logging a certain string. Here is the method I am trying to log the String from: .method private getValue(Ljava/lang/String;)[B .locals 2 .param…
1
vote
1 answer

How can I count method calls inside APK? (using .smali format)

I am trying to develop a tool that basically analyses an Android app APK and counts the number of calls to a specific API method (e.g., android.app.AlarmManager.set()) 1. What approach do you recommend? So far I have used APKTool and now I…
Luis Cruz
  • 393
  • 1
  • 14