android 反编译和代码解读

书史足自悦,安用勤与劬。这篇文章主要讲述android 反编译和代码解读相关的知识,希望能为你提供帮助。
二 错误代码还原规则
if…else 语句:反编译代码
 

if (paramBoolean) paramTextView.setTextColor(-16727809); while (true) { return; paramTextView.setTextColor(-1315861); }

 
还原后

 
if (paramBoolean) { paramTextView.setTextColor(-16727809); } else { paramTextView.setTextColor(-1315861); }

 
会把if ..esle 反编译成 if …while(true)结构.

 
反编译代码

 
if (paramInt1 != 1) break label185; if (this.countChild_1 == null) { this.countChild_1 = new PokerCountChild(this.mContext); this.countChild_1 = new PokerCountChild(this.mContext); this.countChild_1.setPosition((int)(0.83D * BaseGameActivity.screenWidth

 
- this.countChild_1.getWidth()), (int)(0.2D * BaseGameActivity.screenHeight)); this.countChild_1.setCount(paramInt2); addOneChild(this.countChild_1); if (paramInt2 == 0) this.countChild_1.setAlpha(0); } this.countChild_1.setCount(paramInt2); } label185: do return; while (paramInt1 != 2); if (this.countChild_2 == null) { this.countChild_2 = new PokerCountChild(this.mContext); this.countChild_2 = new PokerCountChild(this.mContext); this.countChild_2.setPosition((int)(0.17D * BaseGameActivity.screenWidth),

 
(int)(0.2D * BaseGameActivity.screenHeight)); this.countChild_2.setCount(paramInt2); addOneChild(this.countChild_2); if (paramInt2 == 0) this.countChild_2.setAlpha(0); } this.countChild_2.setCount(paramInt2);

 
还原

 
if(i == 1) { if(countChild_1 == null) { countChild_1 = new PokerCountChild(mContext); countChild_1 = new PokerCountChild(mContext); countChild_1.setPosition((int)(0.83D *

 
(double)BaseGameActivity.screenWidth - (double)countChild_1.getWidth()),

 
(int)(0.2D * (double)BaseGameActivity.screenHeight)); countChild_1.setCount(j); addOneChild(countChild_1); if(j == 0) countChild_1.setAlpha(0); } countChild_1.setCount(j); } else if(i == 2) { if(countChild_2 == null) { countChild_2 = new PokerCountChild(mContext); countChild_2 = new PokerCountChild(mContext); countChild_2.setPosition((int)(0.17D *

 
(double)BaseGameActivity.screenWidth), (int)(0.2D *

 
(double)BaseGameActivity.screenHeight)); countChild_2.setCount(j); addOneChild(countChild_2); if(j == 0) countChild_2.setAlpha(0); } countChild_2.setCount(j); return; } 会将语句倒序,出现break label结构

 
 

反编译代码
android 反编译和代码解读

文章图片
 
jd-gui有时会将whilei语句翻译成if,此处要将if改成while
 
switch语句反编译代码
 
switch (this.mBand) { default: case 0: case 1: case 2: } while (true) { return; this.mBand.setText("FM1"); continue; this.mBand.setText("FM2"); continue; this.mBand.setText("AM"); } 还原

 
switch (mBand) { case 0: mBand.setText("FM1"); break; case 1: mBand.setText("FM2"); break; case 2: mBand.setText("AM"); break; default: }

switch规则就是一个continue对应一个case.要注意是是要外层的continue才算数,在if里的continue不算
enum枚举
android 反编译和代码解读

文章图片
 
还原
android 反编译和代码解读

文章图片
 
jd-gui
http://www.qiaodiqiu.com/how-to-read-java-confusion-after-the-anti-compiled-code.html
http://blog.csdn.net/xyz_fly/article/details/8014455
http://blog.csdn.net/hp_2008/article/details/8626010
jad
http://blog.csdn.net/z3h/article/details/2515287
http://blog.csdn.net/z3h/article/details/2640522
【android 反编译和代码解读】 











    推荐阅读