十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
一、类型

| V | void 空类型,仅用做返回类型 |
| Z | boolean布尔型 |
| B | byte字节型 |
| S | short短整型 16位 |
| C | char字符型 |
| I | int整型 |
| J | long 长整型 64位 |
| F | float浮点型 |
| D | double双精度型 64位 |
| [I | 等同于int[ ] |
| [[I | 等同于int[ ][ ] |
七、davlik opcode
http://pallergabor.uw.hu/androidblog/dalvik_opcodes.html
八、常见源码结构
1. 构造函数publicclass example{
privatestaticintCounter;
public example(){Counter=16;}
2.for结构publicstaticvoidLoopExample()
{
for(int i=0; i
}
3.switch结构publicstaticvoidSwitchExample()
{
int val=42;
switch(val){
case1:System.out.println("val 1");break;
case2:System.out.println("val 2");break;
case42:System.out.println("val 42");break;
case5:System.out.println("val 5");break;
default:System.out.println("invalid value");break;
}
}
在smali中,switch结构,首先使用spare-switch解析default分支,接着处理其他分支.这种处理流程,会导致在使用dex2jar进行反编译时(将dex文件转换为jar)出错,使用ded进行反编译的结果会稍微好一点。
4.try-catchpublicstaticvoidTryCatchExample()
{
String urlStr="google.com";
try{
// Get the image
URL url=new URL(urlStr);
InputStreamis= url.openStream();
is.close();
}catch(MalformedURLException e){
// Print out the exception that occurred
System.out.println("Invalid_URL"+ urlStr+" :"+ e.getMessage());
}catch(IOException e){
// Print out the exception that occurred
System.out.println("Unable?to?execute"+ urlStr+":"+ e.getMessage());
}
}
同样的,使用ded进行反编译的结果会稍微好一点 5.数组publicstaticvoidArrayExample()
{
String someArray[]=newString[5];
someArray[0]="set value at index 0";
someArray[1]="index 1 has this value";
if( someArray[0].equals(someArray[1]))
{
System.out.println("array at index 0 = 1 (wont?happen)");
}
}
参考:
https://code.google.com/p/smali/wiki/TypesMethodsAndFields
http://bbs.pediy.com/showthread.php?t=151769Android恶意代码分析 claud