【android】解码.9图片及xml

本文介绍了如何使用apktool.jar包解密Android应用中的.9图片和raw资源,通过编写Java代码实现解密过程,便于开发者获取所需资源进行项目开发。


原文地址: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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值