【android】解码.9图片及xml

来源:互联网 发布:华为大数据开发工程师 编辑:程序博客网 时间:2024/05/21 22:54


原文地址:http://blog.csdn.net/cc_want/article/details/51381099

1.前言

在公司项目开发中,往往遇到需要一些图片资源来对android界面进行美化,然而有些时候,小公司没有美工怎么办?so easy.下载现成apk,解压res资源,然后发现,图片被编译了?没关系,接下来我们来编写程序解密.9图片

    解密后  

2.实现

首先从下面附件中下载apktool.jar包,对于apktool我们就不用多说了,接下来在eclipse新建java工程,导入apktool.jar,创建java类,编写方法

public void decode9path(File inFile,File outfile){try {InputStream in=new FileInputStream(inFile);OutputStream out=new FileOutputStream(outfile);Res9patchStreamDecoder de=new Res9patchStreamDecoder();de.decode(in, out);} catch (Exception e) {e.printStackTrace();}}

对的,这就是解密.9图片的方法,具体实现请看brut.androlib.res.decoder.Res9patchStreamDecoder这里就不多说了

接下来是解密raw资源的方法

public void decodeRaw(File inFile,File outfile){try {InputStream in=new FileInputStream(inFile);OutputStream out=new FileOutputStream(outfile);ResRawStreamDecoder rrsd=new ResRawStreamDecoder();rrsd.decode(in, out);} catch (Exception e) {e.printStackTrace();}}

3.附件

http://download.csdn.net/detail/cc_want/9517501

0 0
原创粉丝点击