• 新浪微博2.5.1 for Android 去广告


    新浪微博更新到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.weiboHomeListActivity,打开直接看代码了。。。(找去广告的关键地方,自己根据情况搜索关键字,比如: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程序给反编译出来,在反编译出来的程序目录下,找smalicomsinaweibo 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

  • 相关阅读:
    拓扑排序模板
    杭电 2066 一个人的旅行
    杭电 1596 find the safest road (最小路径变形求最大安全度)
    【状态压缩DP】【BZOJ1087】【SCOI2005】互不侵犯king
    【bzoj1001】【最短路】【对偶图】【最大流转最小割】狼抓兔子题解
    [BZOJ1179][APIO2009][强连通分量Tarjan+spfa]ATM
    [BZOJ1194][HNOI2006][强连通分量Tarjan+dfs]潘多拉的盒子
    说一说ST表 讲一讲水题
    【强连通分量】tarjan算法及kosaraju算法+例题
    对拍程序讲解及源码举例
  • 原文地址:https://www.cnblogs.com/zeroone/p/3294179.html
Copyright © 2020-2023  润新知