往期教程:
apk反编译修改教程系列-----修改apk应用名称 任意修改名称 签名【一】
apk反编译修改教程系列-----任意修改apk版本号 版本名 防止自动更新【二】
apk反编译修改教程系列-----修改apk中的图片 任意更换apk桌面图片【三】
apk反编译修改教程系列---简单去除apk联网权限 其他权限 无法自动更新等【四】
apk反编译修改教程系列---简单去除apk开屏广告【五】
apk反编译修改教程系列---修改apk设置菜单选项名称 修改默认设置 增加减少选项【六】
今天的教程简单演示一下如何给一款apk加启动弹窗 对话框等。
演示apk:华硕手机计算器4.0.0.52
工具:MT或者电脑端反编译工具
操作步骤:
首先正常安装打开这款软件是这样的。工具打开很简洁,没有任何权限提示
按常规操作。首先找到这个apk,使用MT的ACTIVITY记录,点击开启。我们要先查看这个工具启动的主界面Activity 的代码名字。
然后打开这个计算器工具,在上方的Activity就可以看到工具主界面
点击查看,选择classes.dex文件。关于apk资源内各个文件夹的具体作用可以查看以前的博文都有说明。点击classes.dex文件。出来菜单选择Dex编辑器++
现在我们需要工具刚才查看到计算器的Activity记录来找到这个完整路径文件
完整的路径com.asus.calculator.Calc
.class public Lcom/asus/calculator/Calculator;
.super Lcom/asus/calculator/aa;
# interfaces
.implements Landroid/view/View$OnClickListener;
.implements Lcom/asus/calculator/z;
# static fields
.field private static i:Ljava/lang/String;
.field private static j:Ljava/lang/String;
.field private static k:Ljava/lang/String;
# instance fields
.field private A:I
.field private B:Landroid/view/ViewTreeObserver$OnGlobalLayoutListener;
.field private C:Ljava/lang/Runnable;
.field public a:Lcom/asus/calculator/history/a;
.field protected b:Lcom/asus/calculator/w;
.field c:Z
.field d:Z
.field private e:Landroid/content/Context;
.field private final f:Ljava/lang/String;
.field private final g:Ljava/lang/String;
.field private h:Landroid/os/Bundle;
.field private l:Lcom/asus/calculator/af;
.field private m:Lcom/asus/calculator/y;
.field private n:Lcom/asus/calculator/MyViewPager;
.field private o:Landroid/view/View;
.field private p:Landroid/view/View;
.field private q:Landroid/view/View;
.field private r:Landroid/view/View;
.field private s:Landroid/view/View;
.field private t:Landroid/content/BroadcastReceiver;
.field private u:Lcom/asus/calculator/ad;
.field private v:Ljava/util/List;
.annotation system Ldalvik/annotation/Signature;
value = {
"Ljava/util/List",
"<",
"Landroid/view/View;",
">;"
}
.end annotation
.end field
.field private w:Landroid/view/View;
.field private x:Ljava/util/List;
.annotation system Ldalvik/annotation/Signature;
value = {
"Ljava/util/List",
"<",
"Ljava/lang/Integer;",
">;"
}
.end annotation
.end field
.field private y:Landroid/os/Handler;
.field private z:Z
# direct methods
.method static constructor <clinit>()V
.registers 1
const-string v0, "asus.intent.action.INSTALL_DEMOAPK"
sput-object v0, Lcom/asus/calculator/Calculator;->i:Ljava/lang/String;
const-string v0, "com.asus.livedemo"
sput-object v0, Lcom/asus/calculator/Calculator;->j:Ljava/lang/String;
const-string v0, "com.asus.livedemoservice"
sput-object v0, Lcom/asus/calculator/Calculator;->k:Ljava/lang/String;
return-void
.end method
.method public constructor <init>()V
.registers 5
const/4 v3, 0x1
const/4 v2, 0x0
const/4 v1, 0x0
invoke-direct {p0}, Lcom/asus/calculator/aa;-><init>()V
new-instance v0, Lcom/asus/calculator/w;
invoke-direct {v0, p0}, Lcom/asus/calculator/w;-><init>(Landroid/content/Context;)V
iput-object v0, p0, Lcom/asus/calculator/Calculator;->b:Lcom/asus/calculator/w;
const-string v0, "isLockedScreen"
iput-object v0, p0, Lcom/asus/calculator/Calculator;->f:Ljava/lang/String;
const-string v0, "isScreenOn"
iput-object v0, p0, Lcom/asus/calculator/Calculator;->g:Ljava/lang/String;
iput-object v1, p0, Lcom/asus/calculator/Calculator;->o:Landroid/view/View;
iput-object v1, p0, Lcom/asus/calculator/Calculator;->p:Landroid/view/View;
iput-object v1, p0, Lcom/asus/calculator/Calculator;->q:Landroid/view/View;
iput-object v1, p0, Lcom/asus/calculator/Calculator;->r:Landroid/view/View;
iput-object v1, p0, Lcom/asus/calculator/Calculator;->s:Landroid/view/View;
iput-object v1, p0, Lcom/asus/calculator/Calculator;->t:Landroid/content/BroadcastReceiver;
iput-object v1, p0, Lcom/asus/calculator/Calculator;->u:Lcom/asus/calculator/ad;
iput-object v1, p0, Lcom/asus/calculator/Calculator;->v:Ljava/util/List;
iput-object v1, p0, Lcom/asus/calculator/Calculator;->w:Landroid/view/View;
new-array v0, v3, [Ljava/lang/Integer;
const v1, 0x7f0f00db
invoke-static {v1}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
move-result-object v1
aput-object v1, v0, v2
invoke-static {v0}, Ljava/util/Arrays;->asList([Ljava/lang/Object;)Ljava/util/List;
move-result-object v0
iput-object v0, p0, Lcom/asus/calculator/Calculator;->x:Ljava/util/List;
new-instance v0, Landroid/os/Handler;
invoke-direct {v0}, Landroid/os/Handler;-><init>()V
iput-object v0, p0, Lcom/asus/calculator/Calculator;->y:Landroid/os/Handler;
iput-boolean v2, p0, Lcom/asus/calculator/Calculator;->z:Z
iput v2, p0, Lcom/asus/calculator/Calculator;->A:I
new-instance v0, Lcom/asus/calculator/g;
invoke-direct {v0, p0}, Lcom/asus/calculator/g;-><init>(Lcom/asus/calculator/Calculator;)V
iput-object v0, p0, Lcom/asus/calculator/Calculator;->B:Landroid/view/ViewTreeObserver$OnGlobalLayoutListener;
new-instance v0, Lcom/asus/calculator/h;
invoke-direct {v0, p0}, Lcom/asus/calculator/h;-><init>(Lcom/asus/calculator/Calculator;)V
iput-object v0, p0, Lcom/asus/calculator/Calculator;->C:Ljava/lang/Runnable;
iput-boolean v2, p0, Lcom/asus/calculator/Calculator;->c:Z
iput-boolean v3, p0, Lcom/asus/calculator/Calculator;->d:Z
return-void
.end method
.method private c()V
.registers 6
const/4 v0, 0x0
iget-object v1, p0, Lcom/asus/calculator/Calculator;->TAG:Ljava/lang/String;
const/4 v2, 0x1
new-array v2, v2, [Ljava/lang/Object;
const-string v3, "updateTheme"
aput-object v3, v2, v0
invoke-static {v1, v2}, Lcom/asus/calculator/x;->a(Ljava/lang/String;[Ljava/lang/Object;)V
iget-object v1, p0, Lcom/asus/calculator/Calculator;->mThemeManager:Lcom/asus/calculator/theme/g;
iget-object v2, p0, Lcom/asus/calculator/Calculator;->mLayoutRoot:Landroid/widget/LinearLayout;
invoke-virtual {v1, p0, v2}, Lcom/asus/calculator/theme/g;->a(Landroid/support/v7/a/ac;Landroid/view/View;)V
iget-object v1, p0, Lcom/asus/calculator/Calculator;->u:Lcom/asus/calculator/ad;
if-eqz v1, :cond_1d
iget-object v1, p0, Lcom/asus/calculator/Calculator;->u:Lcom/asus/calculator/ad;
invoke-virtual {v1}, Lcom/asus/calculator/ad;->a()V
:cond_1d
iget-object v1, p0, Lcom/asus/calculator/Calculator;->v:Ljava/util/List;
if-eqz v1, :cond_44
iget-object v1, p0, Lcom/asus/calculator/Calculator;->v:Ljava/util/List;
invoke-interface {v1}, Ljava/util/List;->size()I
move-result v1
if-lez v1, :cond_44
iget-object v1, p0, Lcom/asus/calculator/Calculator;->v:Ljava/util/List;
invoke-interface {v1}, Ljava/util/List;->size()I
move-result v2
move v1, v0
:goto_30
if-ge v1, v2, :cond_44
iget-object v3, p0, Lcom/asus/calculator/Calculator;->mThemeManager:Lcom/asus/calculator/theme/g;
const/4 v4, 0x0
iget-object v0, p0, Lcom/asus/calculator/Calculator;->v:Ljava/util/List;
invoke-interface {v0, v1}, Ljava/util/List;->get(I)Ljava/lang/Object;
move-result-object v0
check-cast v0, Landroid/view/View;
invoke-virtual {v3, v4, v0}, Lcom/asus/calculator/theme/g;->a(Landroid/support/v7/a/ac;Landroid/view/View;)V
add-int/lit8 v0, v1, 0x1
move v1, v0
goto :goto_30
:cond_44
return-void
.end method
.method private d()V
.registers 9
const/4 v7, 0x2
const/4 v6, 0x0
const/4 v5, 0x1
invoke-direct {p0}, Lcom/asus/calculator/Calculator;->e()Z
move-result v0
iput-boolean v0, p0, Lcom/asus/calculator/Calculator;->c:Z
invoke-direct {p0}, Lcom/asus/calculator/Calculator;->f()Z
move-result v0
iput-boolean v0, p0, Lcom/asus/calculator/Calculator;->d:Z
iget-object v0, p0, Lcom/asus/calculator/Calculator;->h:Landroid/os/Bundle;
if-eqz v0, :cond_5c
iget-object v0, p0, Lcom/asus/calculator/Calculator;->h:Landroid/os/Bundle;
const-string v1, "isLockedScreen"
invoke-virtual {v0, v1}, Landroid/os/Bundle;->getBoolean(Ljava/lang/String;)Z
move-result v0
iget-object v1, p0, Lcom/asus/calculator/Calculator;->h:Landroid/os/Bundle;
const-string v2, "isScreenOn"
invoke-virtual {v1, v2}, Landroid/os/Bundle;->getBoolean(Ljava/lang/String;)Z
move-result v1
iget-object v2, p0, Lcom/asus/calculator/Calculator;->TAG:Ljava/lang/String;
new-array v3, v7, [Ljava/lang/Object;
const-string v4, "wasLockedScreen"
aput-object v4, v3, v6
invoke-static {v0}, Ljava/lang/Boolean;->valueOf(Z)Ljava/lang/Boolean;
move-result-object v4
aput-object v4, v3, v5
invoke-static {v2, v3}, Lcom/asus/calculator/x;->a(Ljava/lang/String;[Ljava/lang/Object;)V
iget-object v2, p0, Lcom/asus/calculator/Calculator;->TAG:Ljava/lang/String;
new-array v3, v7, [Ljava/lang/Object;
const-string v4, "wasScreenOn"
aput-object v4, v3, v6
invoke-static {v1}, Ljava/lang/Boolean;->valueOf(Z)Ljava/lang/Boolean;
move-result-object v4
aput-object v4, v3, v5
invoke-static {v2, v3}, Lcom/asus/calculator/x;->a(Ljava/lang/String;[Ljava/lang/Object;)V
const/4 v2, 0x0
iput-object v2, p0, Lcom/asus/calculator/Calculator;->h:Landroid/os/Bundle;
iget-boolean v2, p0, Lcom/asus/calculator/Calculator;->c:Z
if-ne v0, v2, :cond_50
iget-boolean v0, p0, Lcom/asus/calculator/Calculator;->d:Z
if-eq v1, v0, :cond_5c
:cond_50
iget-object v0, p0, Lcom/asus/calculator/Calculator;->TAG:Ljava/lang/String;
new-array v1, v5, [Ljava/lang/Object;
const-string v2, "different states"
aput-object v2, v1, v6
invoke-static {v0, v1}, Lcom/asus/calculator/x;->a(Ljava/lang/String;[Ljava/lang/Object;)V
:cond_5b
:goto_5b
return-void
:cond_5c
iget-boolean v0, p0, Lcom/asus/calculator/Calculator;->d:Z
if-eqz v0, :cond_5b
iget-boolean v0, p0, Lcom/asus/calculator/Calculator;->c:Z
if-eqz v0, :cond_5b
iget-object v0, p0, Lcom/asus/calculator/Calculator;->TAG:Ljava/lang/String;
new-array v1, v5, [Ljava/lang/Object;
const-string v2, "enableShowWhenLocked"
aput-object v2, v1, v6
invoke-static {v0, v1}, Lcom/asus/calculator/x;->a(Ljava/lang/String;[Ljava/lang/Object;)V
if-eqz p0, :cond_7f
invoke-virtual {p0}, Landroid/app/Activity;->getWindow()Landroid/view/Window;
move-result-object v0
const/high16 v1, 0x80000
invoke-virtual {v0, v1}, Landroid/view/Window;->addFlags(I)V
const/high16 v1, 0x400000
invoke-virtual {v0, v1}, Landroid/view/Window;->addFlags(I)V
:cond_7f
iput-boolean v5, p0, Lcom/asus/calculator/Calculator;->z:Z
goto :goto_5b
.end method
.method private e()Z
.registers 6
const-string v0, "keyguard"
invoke-virtual {p0, v0}, Lcom/asus/calculator/Calculator;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;
move-result-object v0
check-cast v0, Landroid/app/KeyguardManager;
invoke-virtual {v0}, Landroid/app/KeyguardManager;->isKeyguardLocked()Z
move-result v0
iget-object v1, p0, Lcom/asus/calculator/Calculator;->TAG:Ljava/lang/String;
const/4 v2, 0x2
new-array v2, v2, [Ljava/lang/Object;
const/4 v3, 0x0
const-string v4, "isLockedScreen"
aput-object v4, v2, v3
const/4 v3, 0x1
invoke-static {v0}, Ljava/lang/Boolean;->valueOf(Z)Ljava/lang/Boolean;
move-result-object v4
aput-object v4, v2, v3
invoke-static {v1, v2}, Lcom/asus/calculator/x;->a(Ljava/lang/String;[Ljava/lang/Object;)V
return v0
.end method
.method private f()Z
.registers 6
const-string v0, "power"
invoke-virtual {p0, v0}, Lcom/asus/calculator/Calculator;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;
move-result-object v0
check-cast v0, Landroid/os/PowerManager;
sget v1, Landroid/os/Build$VERSION;->SDK_INT:I
const/16 v2, 0x14
if-lt v1, v2, :cond_27
invoke-virtual {v0}, Landroid/os/PowerManager;->isInteractive()Z
move-result v0
:goto_12
iget-object v1, p0, Lcom/asus/calculator/Calculator;->TAG:Ljava/lang/String;
const/4 v2, 0x2
new-array v2, v2, [Ljava/lang/Object;
const/4 v3, 0x0
const-string v4, "isScreenOn"
aput-object v4, v2, v3
const/4 v3, 0x1
invoke-static {v0}, Ljava/lang/Boolean;->valueOf(Z)Ljava/lang/Boolean;
move-result-object v4
aput-object v4, v2, v3
invoke-static {v1, v2}, Lcom/asus/calculator/x;->a(Ljava/lang/String;[Ljava/lang/Object;)V
return v0
:cond_27
invoke-virtual {v0}, Landroid/os/PowerManager;->isScreenOn()Z
我们需要定位到工具主界面Activity。加入弹窗内容
内容可以任意修改。原路返回保存可以直接签名或者编译后在签名都可以。此时卸载原软件,安装编译签名后的软件,打开是这样的
效果:
这些步骤都是反编译apk起始的初步常识操作。当然也可以添加对话框等等。类似
或者点击对话框后跳转设定的网页 类似
做这个教程的目的是让初学者了解最简单的反编译操作,尽量每一步都详细说明。其实很多工具都有些类似的功能。例如查看活动Activity记录。很多软件Activity有很多。主界面 辅界面等等。当然加启动弹窗的方式有很多种。其中的一种方法不一定都可以通用所有apk。但要明白原理.
**系列教程将详细的由浅入深解析apk的各种反编译操作。有兴趣的友友可以关注
下期预解析:如何简单的汉化apk