好友
阅读权限255
听众
最后登录1970-1-1
|
zzage
发表于 2011-8-19 02:10
夜深人静,睡不着,就写写东西。
最近我手机的新浪微博更新到2.5.1版,就开始来广告了,伤不起啊...
亲,看到没,手机屏幕就那么一小块,还要往里面塞东西,另外是一个在后台运行的AdCenter服务。
所需要用到的工具有:apktool,JD-GUI,dex2jar,Apk文件签名工具
dex2jar下载地址:http://laichao.googlecode.com/files/...7-SNAPSHOT.zip
JD-GUI下载地址:
windows版JD-GUI:http://laichao.googlecode.com/files/jdgui.zip
Linux版JD-GUI:http://laichao.googlecode.com/files/...ux.i686.tar.gz
apktool下载地址:
http://code.google.com/p/android-apktool/
Apk文件签名工具下载地址:
自己百度吧
1.先把下载来的新浪微博apk程序,用解压工具(winrar)解压出来,解压出来的目录下有个classes.dex文件,用dex2jar把它反编译成jar。
2.用JD-GUI打开这个jar文件,找com.sina.weibo\HomeListActivity,打开直接看代码了。。。(找去广告的关键地方,自己根据情况搜索关键字,比如:AdView)
很容易就在protected void onCreate(Bundle paramBundle)函数里面看到,在初始化广告窗口的代码:
IntentFilter localIntentFilter3 = new IntentFilter();
localIntentFilter3.addAction("com.sina.weibo.action.AdCenter.show");
BroadcastReceiver localBroadcastReceiver3 = this.mAdReceiver;
Intent localIntent3 = registerReceiver(localBroadcastReceiver3, localIntentFilter3);
initAdView();
initAdView:
private void initAdView()
{
Animation localAnimation1 = AnimationUtils.loadAnimation(this, 2130968576);
this.mAdInAnimation = localAnimation1;
Animation localAnimation2 = AnimationUtils.loadAnimation(this, 2130968577);
this.mAdOutAnimation = localAnimation2;
ImageView localImageView1 = (ImageView)findViewById(2131624038);
this.mAdBar1 = localImageView1;
ImageView localImageView2 = (ImageView)findViewById(2131624039);
this.mAdClose1 = localImageView2;
ImageView localImageView3 = (ImageView)findViewById(2131624040);
this.mAdBar2 = localImageView3;
ImageView localImageView4 = (ImageView)findViewById(2131624041);
this.mAdClose2 = localImageView4;
HomeListActivity.14 local14 = new HomeListActivity.14(this);
HomeListActivity.15 local15 = new HomeListActivity.15(this);
this.mAdBar1.setOnClickListener(local14);
this.mAdClose1.setOnClickListener(local15);
this.mAdBar2.setOnClickListener(local14);
this.mAdClose2.setOnClickListener(local15);
}
所以去广告,很简单,只要把onCreate那五行代码给NOP掉就OK了,不过,就这样五行代码nop掉,广告是去了,但退出时,微博客户端还是会崩溃。原因是onCreate注册了一个广播接收但被NOP掉了,但在在销毁窗口的时候,在这个 protected void onDestroy()函数里面有移除这个广播接收,所以就造成崩溃了。所以onDestroy函数下面这两句代码也要nop!
BroadcastReceiver localBroadcastReceiver2 = this.mAdReceiver;
unregisterReceiver(localBroadcastReceiver2);
3.使用apktool把整个新浪微博的apk程序给反编译出来,在反编译出来的程序目录下,找smali\com\sina\weibo\HomeListActivity.smali这个文件,直接记事本打开。搜“com.sina.weibo.action.AdCenter.show”定位到onCreate函数,把下面这几行给删除掉。
.line 329
new-instance v1, Landroid/content/IntentFilter;
invoke-direct {v1}, Landroid/content/IntentFilter;-><init>()V
.line 330
.local v1, myAdIntentFilter:Landroid/content/IntentFilter;
const-string v3, "com.sina.weibo.action.AdCenter.show"
invoke-virtual {v1, v3}, Landroid/content/IntentFilter;->addAction(Ljava/lang/String;)V
.line 331
iget-object v3, p0, Lcom/sina/weibo/HomeListActivity;->mAdReceiver:Landroid/content/BroadcastReceiver;
invoke-virtual {p0, v3, v1}, Lcom/sina/weibo/HomeListActivity;->registerReceiver(Landroid/content/BroadcastReceiver;Landroid/content/IntentFilter;)Landroid/content/Intent;
.line 334
invoke-direct {p0}, Lcom/sina/weibo/HomeListActivity;->initAdView()V
再搜索下"protected onDestroy()"定位到onDestroy函数里,把这几行也给删除掉!
.line 808
iget-object v0, p0, Lcom/sina/weibo/HomeListActivity;->mAdReceiver:Landroid/content/BroadcastReceiver;
invoke-virtual {p0, v0}, Lcom/sina/weibo/HomeListActivity;->unregisterReceiver(Landroid/content/BroadcastReceiver;)V
4,最后还要去删除掉的ADCenter服务!不然这个服务会一直在后台运行着,看着某地方都会疼!打开在新浪微博的apk程序反编译出来的程序目录下的AndroidManifest.xml文件。删除掉下面这几行,就可以去掉AdCenter服务。
<service android:name=".business.AdCenter">
<intent-filter>
<action android:name="com.sina.weibo.action.speed" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</service>
5,用apktool把那个修改去广告后的新浪微博反编译的程序目录编译成apk文件。最后在打上签名,去广告版就完成了
去广告版传送门:http://www.52pojie.cn/forum.php?mod=viewthread&tid=104819
ZzAge[LCG][80DFJ]
吾爱破解论坛:http://www.52pojie.cn
80DFJ技术论坛:http://www.80dfj.org。
|
免费评分
-
查看全部评分
|
发帖前要善用【论坛搜索】功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。 |
|
|
|
|