问题
正常的res 会被分配一个资源id—res id
aapt编译后会在gen文件生成对应的R文件对应的变量
R文件中类和成员变量都是 static final 类型的
public final class R {
public static final class anim {
public static final int abc_fade_in=0x7f040000;
public static final int abc_fade_out=0x7f040001;
public static final int abc_grow_fade_in_from_bottom=0x7f040002;
public static final int abc_popup_enter=0x7f040003;
public static final int abc_popup_exit=0x7f040004;
public static final int abc_shrink_fade_out_from_bottom=0x7f040005;
public static final int abc_slide_in_bottom=0x7f040006;
public static final int abc_slide_in_top=0x7f040007;
public static final int abc_slide_out_bottom=0x7f040008;
public static final int abc_slide_out_top=0x7f040009;
}
setContentView findViewById都会使用这里的常量,编译过后直接是常量值。
protected void onCreate(Bundle paramBundle)
{
super.onCreate(paramBundle);
setContentView(2130903063);
setTitle(this.title);
this.tv_opName = ((TextView)findViewById(2131230893));
this.tv_opDescription = ((TextView)findViewById(2131230894));
this.tv_opName.setText(this.name);
this.tv_opDescription.setText(this.description);
((Button)findViewById(2131230895)).setOnClickListener(new View.OnClickListener()
{
public void onClick(View paramView)
{
GTOutParaPerfDialog.this.dismiss();
}
});
问题出现在微信里面不是常量值,是一个常量
this.glB = ((SnsSightUploadSayFooter)findViewById(a.i.say_footer));
this.glB.setMMEditText(this.gly);
this.glB.setVisibility(0);
找到对应的类
和正常的R文件相比,这个类的区别是做了混淆,变量没有加final
这在语法树上就有差别了,本来findViewById 参数应该 Constant 现在变成了 StaticExpression
工作需要 不做什么违法乱纪的事儿