APK反编译、修改、重打包、签名

1、反编译:

java -jar apktool_2.0.0.jar d TestSMSDemo.apk  

默认反编译到TestSMSDemo文件夹下,apktool下载请点击这里

2、修改AndroidManifest.xml

?
1
2
3
4
5
6
7
< application  android:icon = "@drawable/icon"
     android:label = "@string/app_name" 
     android:name = ".VideoApplication" 
     android:theme = "@android:style/Theme.NoTitleBar.Fullscreen" 
     android:uiOptions = "splitActionBarWhenNarrow" 
     android:debuggable = "true" >
     <!-- 主要添加debuggable,为以后调试apk做准备-->

3、重新打包:

java -jar apktool_2.0.0.jar b TestSMSDemo(之前反编译生成的文件夹名,如果是out请写out)

默认会将文件重新打包到TestSMSDemo/dist目录下

4、签名:

 1)生成keystore。可以使用命令行生成keystore,也可以使用Eclipse签名一个demo生成keystore,记住保存位置就好了。

  • 使用命令行生成:

       keytool -genkey -v -keystore mykeystore(可以任意名字) -alias linlin(别名,可以任意,但是在后面会用到这个别名,所以要记清楚) -keyalg RSA -validity 20000

然后根据提示输入需要的内容。

  • 使用Eclipse生成就不用说了,签名apk的时候都用到,记住生成keystore保存位置。简单易行。

 2)签名apk

    jarsigner -verbose -keystore mykeystore -signedjar android_signed.apk(目标名字) TestSMSDemo.apk(要签名的apk) linlin(这个地方就是上面说要记住的别名 -alias,看有些例子上面这个地方字符串用‘ ’号引起来是错误的,直接写字符串就好了)


附:

()     里面是说明文字,在使用命令时请忽视

为了方便记忆可以将-alias和keystore的名字一致。如果-alias跟keystore名字不一致,又忘记了写的什么,可以使用Eclipse查看。具体方法就是打包程序,然后选择该keystore,输入密码后会自动显示alias的名字。如下图所示:

APK反编译、修改、重打包、签名

APK反编译、修改、重打包、签名

usage:apktool 
-advance,--advanced prints advance information. 
-version,--version prints the version then exits 
usage: apktool if|install-framework [options] <framework.apk> 
-p,--frame-path <dir> Stores framework files into <dir>. 
-t,--tag <tag> Tag frameworks using <tag>. 
usage: apktool d[ecode] [options] <file_apk> 
-f,--force Force delete destination directory. 
-o,--output <dir> The name of folder that gets written. Default is apk.out 
-p,--frame-path <dir> Uses framework files located in <dir>. 
-r,--no-res Do not decode resources. 
-s,--no-src Do not decode sources. 
-t,--frame-tag <tag> Uses framework files tagged by <tag>. 
usage: apktool b[uild] [options] <app_path> 
-f,--force-all Skip changes detection and build all files. 
-o,--output <dir> The name of apk that gets written. Default is dist/name.apk 
-p,--frame-path <dir> Uses framework files located in <dir>. 

For additional info, see: http://code.google.com/p/android-apktool/ 
For smali/baksmali info, see: http://code.google.com/p/smali/  用于Odex-dex后面说这个的使用

error:

jarsigner: 找不到xxx的证书链。xxx必须引用包含私有密钥和相应的公共 密钥证书链的有效密钥库密钥条目。

出现类型提示是因为alias没有填写正确。

使用aiqiyi客户端测试,重新打包签名后正常运行没问题。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值