https://github.com/JesusFreke/smali/wiki/TypesMethodsAndFields

Types

dalvik's bytecode has two major classes of types, primitive types and reference types. Reference types are objects and arrays, everything else is a primitive.

Primitives are represented by a single letter. I didn't come up with these abbreviations - they are what is actually stored in the dex file, in string form. They are specified in the dex-format.html document (dalvik/docs/dex-format.html in the AOSP repository)

V void - can only be used for return types
Z boolean
B byte
S short
C char
I int
J long (64 bits)
F float
D double (64 bits)

Objects take the form Lpackage/name/ObjectName; - where the leading L indicates that it is an object type, package/name/ is the package that the object is in, ObjectName is the name of the object, and ; denotes the end of the object name. This would be equivalent to package.name.ObjectName in java. Or for a more concrete example, Ljava/lang/String; is equivalent to java.lang.String

Arrays take the form [I - this would be an array of ints with a single dimension. i.e. int[] in java. For arrays with multiple dimensions, you simply add more [ characters. [[I = int[][][[[I = int[][][], etc. (Note: The maximum number of dimensions you can have is 255).

You can also have arrays of objects, [Ljava/lang/String; would be an array of Strings.

Methods

Methods are always specified in a very verbose form that includes the type that contains the method, the method name, the types of the parameters and the return type. All this information is required for the virtual machine to be able to find the correct method, and to be able to perform static analysis on the bytecode (for verification/optimization purposes)

They take the form

Lpackage/name/ObjectName;->MethodName(III)Z

In this example, you should recognize Lpackage/name/ObjectName; as a type. MethodName is obviously the name of the method. (III)Z is the method's signature. III are the parameters (in this case, 3 ints), and Z is the return type (bool).

The method parameters are listed one right after another, with no separators between them.

Here's a more complex example:

method(I[[IILjava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

In java, this would be

String method(int, int[][], int, String, Object[])

Fields

Fields are likewise always specified in verbose form that includes the type that contains the field, the name of the field, and the type of the field. Again, this is to allow the virtual machine to be able to find the correct field, as well as to perform static analysis on the bytecode.

They take the form

Lpackage/name/ObjectName;->FieldName:Ljava/lang/String;

This should be pretty self-explanatory - it is the package name, the field name and the type of the field respectively.

TypesMethodsAndFields的更多相关文章

  1. apk反编译之二——smali学习

    在apk被反编译后,原来的java程序会以smali文件呈现.这就需要补充smali的知识.依旧参考官方文档,择日我将把官方文档做一下翻译.今日先贴出链接地址: 1:了解smali字节码的寄存器 请参 ...

  2. Smali文件语法解析

    大家都应该知道APK文件其实就是一个MIME为ZIP的压缩包,我们修改ZIP后缀名方式可以看到内部的文件结构,例如修改后缀后用RAR打开鳄鱼小顽皮APK能看到的是(Google Play下载的完整版版 ...

  3. Smali语法:数据类型、方法和字段

    数据类型 dalvik字节码有两种类型,原始类型和引用类型.对象和数组是引用类型,其它都是原始类型. smali数据类型都是用一个字母表示,如果你熟悉Java的数据类型,你会发现表示smali数据类型 ...

  4. smali文件内容具体介绍

    大家都应该知道APK文件其实就是一个MIME为ZIP的压缩包,我们修改ZIP后缀名方式可以看到内部的文件结构,例如修改后缀后用RAR打开鳄鱼小顽皮APK能看到的是(Google Play下载的完整版版 ...

随机推荐

  1. 高并发场景系列(一) 利用redis实现分布式事务锁,解决高并发环境下减库存

    原文:http://blog.csdn.net/heyewu4107/article/details/71009712 高并发场景系列(一) 利用redis实现分布式事务锁,解决高并发环境下减库存 问 ...

  2. [转载]android工程中引入另一个工程中的资源

    原文地址:android工程中引入另一个工程中的资源作者:87fayuan 在项目中可能遇到这样的问题:项目过大,于是细分为N个子模块来做,每个模块都是不同的工程.涉及到activity传数据时,可以 ...

  3. 1:MUI选择器组件抛出“n.getSelectedItem is not a function”异常的解决办法 2:mui三级联动 3:移动端关闭虚拟键盘

    1:如下图 问题:引用了mui的地址选择的三级联动的应用在h5上的组件 百度发现别人思路对 Array 原型链方法扩充时,会抛出这个异常. 修改方法: mui.poppicker.js 第 112 行 ...

  4. LaTeX 的对参考文献的处理

      LaTeX 的对参考文献的处理实在是非常的方便,我用过几次,有些体会,写出来供大家 参考.当然,自己的功力还不够深,有些地方问题一解决就罢手了,没有细究.     LaTeX 对参考文献的处理有这 ...

  5. 项目部署问题:xftp无法连接服务器、Nginx403 Forbidden解决、nginx反向代理解决前端跨域问题

    一.xftp无法连接服务器 在xftp中配置正确的ip,用户名和密码后,居然无法连接 解决方案:将协议里面的FTP换成SFTP,注意换成SFTP后端口就默认换成22,要还是原来的21就还是连不上的哈 ...

  6. mac office 设置默认视图显示比例

    1.打开word 2.fn+option+F11,选中Normal,右键插入模块,复制以下脚本到编辑器中 Sub AutoOpen() ActiveWindow.ActivePane.View.Zoo ...

  7. scrapy中ROBOTSTXT_OBEY = True的相关说明

    在scrapy中创建项目以后,在settings文件中有这样的一条默认开启的语句: # Obey robots.txt rules ROBOTSTXT_OBEY = True 观察代码可以发现,默认为 ...

  8. 《javascript高级程序设计》读书笔记(四)引用类型

    第五章:引用类型 Object类型 创建object实例的两种方式: 1.new方式 var person = new Object(); person.name = "haozk" ...

  9. PostgreSQL 9.5,带来 UPSERT 等新特性

    PostgreSQL 9.5于2016年1月7日正式发布,此版本主要带来了以下几个方面的特性: UPSERT, Row Level Security, and Big Data 1)UPSERTUPS ...

  10. .html(),.text()和.val()的差异

    .html(),.text()和.val()的差异总结:  .html(),.text(),.val()三种方法都是用来读取选定元素的内容:只不过.html()是用来读取元素的html内容(包括htm ...