反编译apk

1.查看xml文件

使用apktool工具,使用此 apktool d *.apk来编译

如果报如下错

Microsoft Windows [版本 6.1.7601]
版权所有 (c) 2009 Microsoft Corporation。保留所有权利。

C:\Users\Administrator\Desktop\apktool>apktool d 信手书.apk
I: Using Apktool 2.0.0-RC2 on 信手书.apk
I: Loading resource table...
W: Config flags size > 38. Exceeding bytes: 0x746E000000000000000000000000000000
00.
W: Invalid config flags detected. Dropping resources: string-sr-ERR0
I: Loading resource table...
W: Config flags size > 38. Exceeding bytes: 0x746E000000000000000000000000000000
00.
W: Invalid config flags detected. Dropping resources: string-sr-ERR1
I: Decoding AndroidManifest.xml with resources...
I: Loading resource table from file: C:\Users\Administrator\apktool\framework\1.
apk
I: Regular manifest package...
I: Decoding file-resources...
W: Could not decode attr value, using undecoded value instead: ns=android, name=
touchscreenBlocksFocus, value=0xffffffff
W: Could not decode attr value, using undecoded value instead: ns=android, name=
scrollIndicators, value=0x00000003
I: Decoding values */* XMLs...
Exception in thread "main" brut.androlib.err.UndefinedResObject: resource spec:
0x01010490
        at brut.androlib.res.data.ResPackage.getResSpec(ResPackage.java:59)
        at brut.androlib.res.data.ResTable.getResSpec(ResTable.java:58)
        at brut.androlib.res.data.ResTable.getResSpec(ResTable.java:54)
        at brut.androlib.res.data.value.ResReferenceValue.getReferent(ResReferen
ceValue.java:60)
        at brut.androlib.res.data.value.ResStyleValue.serializeToResValuesXml(Re
sStyleValue.java:54)
        at brut.androlib.res.AndrolibResources.generateValuesFile(AndrolibResour
ces.java:564)
        at brut.androlib.res.AndrolibResources.decode(AndrolibResources.java:327
)
        at brut.androlib.Androlib.decodeResourcesFull(Androlib.java:123)
        at brut.androlib.ApkDecoder.decode(ApkDecoder.java:102)
        at brut.apktool.Main.cmdDecode(Main.java:170)
        at brut.apktool.Main.main(Main.java:86)

C:\Users\Administrator\Desktop\apktool>

C:\Users\Administrator\Desktop\apktool>

请下载framework-res.apk文件,然后执行此命令 apktool if framework-res.apk

如果出现如下错误

Microsoft Windows [版本 6.1.7601]
版权所有 (c) 2009 Microsoft Corporation。保留所有权利。

C:\Users\Administrator\Desktop\apktool>apktool if freagmework-res.apk
Exception in thread "main" brut.androlib.AndrolibException: java.io.FileNotFound
Exception: freagmework-res.apk (系统找不到指定的文件。)
        at brut.androlib.res.AndrolibResources.installFramework(AndrolibResource
s.java:681)
        at brut.androlib.Androlib.installFramework(Androlib.java:649)
        at brut.apktool.Main.cmdInstallFramework(Main.java:256)
        at brut.apktool.Main.main(Main.java:92)
Caused by: java.io.FileNotFoundException: freagmework-res.apk (系统找不到指定的
文件。)
        at java.io.RandomAccessFile.open(Native Method)
        at java.io.RandomAccessFile.<init>(Unknown Source)
        at org.apache.commons.compress.archivers.zip.ZipFile.<init>(ZipFile.java
:203)
        at org.apache.commons.compress.archivers.zip.ZipFile.<init>(ZipFile.java
:182)
        at org.apache.commons.compress.archivers.zip.ZipFile.<init>(ZipFile.java
:143)
        at brut.directory.ZipExtFile.<init>(ZipExtFile.java:28)
        at brut.androlib.res.AndrolibResources.installFramework(AndrolibResource
s.java:647)
        ... 3 more

C:\Users\Administrator\Desktop\apktool>apktool if framework-res.apk
I: Framework installed to: C:\Users\Administrator\apktool\framework\1.apk

C:\Users\Administrator\Desktop\apktool>apktool d 信手书.apk
I: Using Apktool 2.0.0-RC2 on 信手书.apk
I: Loading resource table...
W: Config flags size > 38. Exceeding bytes: 0x746E000000000000000000000000000000
00.
W: Invalid config flags detected. Dropping resources: string-sr-ERR0
I: Loading resource table...
W: Config flags size > 38. Exceeding bytes: 0x746E000000000000000000000000000000
00.
W: Invalid config flags detected. Dropping resources: string-sr-ERR1
I: Decoding AndroidManifest.xml with resources...
I: Loading resource table from file: C:\Users\Administrator\apktool\framework\1.
apk
W: Could not decode attr value, using undecoded value instead: ns=android, name=
supportsRtl, value=0xffffffff
I: Regular manifest package...
I: Decoding file-resources...
W: Could not decode attr value, using undecoded value instead: ns=android, name=
state_activated, value=0xffffffff
W: Could not decode attr value, using undecoded value instead: ns=android, name=
layoutDirection, value=0x00000003
W: Could not decode attr value, using undecoded value instead: ns=android, name=
layout_alignParentEnd, value=0xffffffff
W: Could not decode attr value, using undecoded value instead: ns=android, name=
layout_marginStart, value=0x00008001
W: Could not decode attr value, using undecoded value instead: ns=android, name=
layout_toStartOf, value=0x7f080070
W: Could not decode attr value, using undecoded value instead: ns=android, name=
layoutDirection, value=0x00000000
W: Could not decode attr value, using undecoded value instead: ns=android, name=
layout_toEndOf, value=0x7f0800c3
W: Could not decode attr value, using undecoded value instead: ns=android, name=
background, value=0x0101032c
W: Could not decode attr value, using undecoded value instead: ns=android, name=
layout_toEndOf, value=0x7f0800c3
W: Could not decode attr value, using undecoded value instead: ns=android, name=
alpha, value=0x7f060057
W: Could not decode attr value, using undecoded value instead: ns=android, name=
alpha, value=0x7f060055
W: Could not decode attr value, using undecoded value instead: ns=android, name=
exitFadeDuration, value=0x010e0001
W: Could not decode attr value, using undecoded value instead: ns=android, name=
viewportWidth, value=0x41c00000
W: Could not decode attr value, using undecoded value instead: ns=android, name=
viewportHeight, value=0x41c00000
W: Could not decode attr value, using undecoded value instead: ns=android, name=
fillColor, value=0x0106000b
W: Could not decode attr value, using undecoded value instead: ns=android, name=
pathData, value=0x00000007
Exception in thread "main" java.lang.NullPointerException
        at java.io.Writer.write(Unknown Source)
        at brut.androlib.res.util.ExtMXSerializer.writeAttributeValue(ExtMXSeria
lizer.java:38)
        at org.xmlpull.mxp1_serializer.MXSerializer.attribute(MXSerializer.java:
673)
        at org.xmlpull.v1.wrapper.classic.XmlSerializerDelegate.attribute(XmlSer
ializerDelegate.java:106)
        at org.xmlpull.v1.wrapper.classic.StaticXmlSerializerWrapper.writeStartT
ag(StaticXmlSerializerWrapper.java:267)
        at org.xmlpull.v1.wrapper.classic.StaticXmlSerializerWrapper.event(Stati
cXmlSerializerWrapper.java:211)
        at brut.androlib.res.decoder.XmlPullStreamDecoder$1.event(XmlPullStreamD
ecoder.java:83)
        at brut.androlib.res.decoder.XmlPullStreamDecoder.decode(XmlPullStreamDe
coder.java:141)
        at brut.androlib.res.decoder.ResStreamDecoderContainer.decode(ResStreamD
ecoderContainer.java:33)
        at brut.androlib.res.decoder.ResFileDecoder.decode(ResFileDecoder.java:1
07)
        at brut.androlib.res.decoder.ResFileDecoder.decode(ResFileDecoder.java:9
1)
        at brut.androlib.res.AndrolibResources.decode(AndrolibResources.java:322
)
        at brut.androlib.Androlib.decodeResourcesFull(Androlib.java:123)
        at brut.androlib.ApkDecoder.decode(ApkDecoder.java:102)
        at brut.apktool.Main.cmdDecode(Main.java:170)
        at brut.apktool.Main.main(Main.java:86)

C:\Users\Administrator\Desktop\apktool>

            请尝试换 apktool最新版,问题就解决了

2.使用如下方法提取class文件

 a>使用压缩工具右键打开apk文件提出压缩过的classes.dex文件

 

 b>使用如下命令对dex文件解析为jar文件

    d2j-dex2jar.bat  classex.dex

   

   如图所示class-dex2jar.jar文件就是对class打包的文件,使用jd-gui查看class-dex2jar.jar文件就是源码文件了

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值