完成了穿山甲资源包打包工具
修复了从Eclipse转移导致UI乱码的问题
This commit is contained in:
@@ -77,6 +77,7 @@ public class CsjTools {
|
||||
reader.close();
|
||||
String apkPackage = getXMLValue("package", tmp);
|
||||
System.out.println(apkPackage);
|
||||
_log.smaliPath("获取到APK包名:"+apkPackage);
|
||||
reader = new BufferedReader(new FileReader(demoManifest));
|
||||
tmp = reader.readLine();
|
||||
String manifest = tmp.replace(getXMLValue("package", tmp), apkPackage) + "\n";
|
||||
@@ -93,7 +94,7 @@ public class CsjTools {
|
||||
}
|
||||
}
|
||||
|
||||
private void out(String srcFile, String encryptFile, int version) {
|
||||
public void out(String srcFile, String encryptFile, int version) {
|
||||
EncryptJar encryptJar = new EncryptJar();
|
||||
encryptJar.encrypt(new File(srcFile), encryptFile, 13, version);
|
||||
|
||||
@@ -168,8 +169,9 @@ public class CsjTools {
|
||||
}
|
||||
}
|
||||
|
||||
private void start(SmaliApkToolsPath toolsPath) {
|
||||
System.out.println("开始制作资源包");
|
||||
private void start() {
|
||||
_log.smaliPath("开始制作资源包");
|
||||
|
||||
commandFile();
|
||||
String apkXML = loadXml(apk_res + File.separator + "public.xml");
|
||||
String demoXML = loadXml(csj_res + File.separator + "public.xml");
|
||||
@@ -206,24 +208,39 @@ public class CsjTools {
|
||||
new File("csj/").mkdirs();
|
||||
}
|
||||
SmaliUtils utils = new SmaliUtils();
|
||||
_log.smaliPath("资源包制作完成,开始打包为apk");
|
||||
utils.bale(csj_Path, csjRes.getAbsolutePath(), new SmaliApkToolsPath() {
|
||||
@Override
|
||||
public void smaliPath(String path) {
|
||||
toolsPath.smaliPath("已出包" + csjRes.getAbsolutePath());
|
||||
System.out.println("耗时:"+(System.currentTimeMillis()-time)/1000+" 秒");
|
||||
_log.smaliPath("已出包" + csjRes.getAbsolutePath());
|
||||
_log.smaliPath("耗时:" + (System.currentTimeMillis() - time) / 1000 + " 秒");
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private long time;
|
||||
private boolean unPackageCSJ = false;
|
||||
private SmaliApkToolsPath _log;
|
||||
|
||||
public void build(String csjPath, String apkPath, SmaliApkToolsPath log) {
|
||||
time=System.currentTimeMillis();
|
||||
time = System.currentTimeMillis();
|
||||
_log=log;
|
||||
unPackageCSJ=false;
|
||||
File csjFile = new File(csjPath);
|
||||
if (new File(csjFile.getName().replace(".apk", "")).exists()) {
|
||||
System.out.println(">?>>"+new File(csjFile.getName().replace(".apk", "")).getAbsolutePath());
|
||||
unPackageCSJ = true;
|
||||
}
|
||||
SmaliUtils utils = new SmaliUtils();
|
||||
Tools.deleteFiles(new File("").getAbsolutePath()+File.separator+new File(csjPath).getName().replace(".apk",File.separator));
|
||||
Tools.deleteFiles(new File("").getAbsolutePath()+File.separator+new File(apkPath).getName().replace(".apk",File.separator));
|
||||
// Tools.deleteFiles(new File("").getAbsolutePath() + File.separator + new File(csjPath).getName().replace(".apk", File.separator));
|
||||
Tools.deleteFiles(new File("").getAbsolutePath() + File.separator + new File(apkPath).getName().replace(".apk", File.separator));
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
log.smaliPath("开始反编译目标APK");
|
||||
_log.smaliPath("开始反编译目标APK");
|
||||
|
||||
|
||||
utils.unPack(apkPath, new SmaliApkToolsPath() {
|
||||
@Override
|
||||
public void smaliPath(String path) {
|
||||
@@ -232,35 +249,42 @@ public class CsjTools {
|
||||
System.out.println(path);
|
||||
apk_Path = path;
|
||||
apk_res = apk_Path + File.separator + "res" + File.separator + "values";
|
||||
runStart(log);
|
||||
runStart();
|
||||
}
|
||||
});
|
||||
log.smaliPath("开始反编译穿山甲Demo");
|
||||
utils.unPack(csjPath, new SmaliApkToolsPath() {
|
||||
@Override
|
||||
public void smaliPath(String path) {
|
||||
log.smaliPath("穿山甲Demo反编译完成:" + path);
|
||||
System.out.println(path);
|
||||
csj_Path = path;
|
||||
csj_res = csj_Path + File.separator + "res" + File.separator + "values";
|
||||
log.smaliPath("开始修改穿山甲清单");
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
new AutoRandomAdSDK().startNotUnPackage(path, new SmaliApkToolsPath() {
|
||||
@Override
|
||||
public void smaliPath(String path) {
|
||||
System.out.println("-------" + path);
|
||||
csjManifest = true;
|
||||
runStart(log);
|
||||
}
|
||||
});
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
});
|
||||
if (unPackageCSJ) {
|
||||
_log.smaliPath("穿山甲demo已存在,不再反编译");
|
||||
csjManifest = true;
|
||||
runStart();
|
||||
} else {
|
||||
_log.smaliPath("开始反编译穿山甲Demo");
|
||||
utils.unPack(csjPath, new SmaliApkToolsPath() {
|
||||
@Override
|
||||
public void smaliPath(String path) {
|
||||
_log.smaliPath("穿山甲Demo反编译完成:" + path);
|
||||
System.out.println(path);
|
||||
csj_Path = path;
|
||||
csj_res = csj_Path + File.separator + "res" + File.separator + "values";
|
||||
_log.smaliPath("开始修改穿山甲");
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
new AutoRandomAdSDK().startNotUnPackage(path, new SmaliApkToolsPath() {
|
||||
@Override
|
||||
public void smaliPath(String path) {
|
||||
_log.smaliPath("穿山甲修改完成");
|
||||
System.out.println("-------" + path);
|
||||
csjManifest = true;
|
||||
runStart();
|
||||
}
|
||||
});
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
|
||||
@@ -269,9 +293,9 @@ public class CsjTools {
|
||||
boolean csjManifest = false;
|
||||
boolean apkUnPackage = false;
|
||||
|
||||
private void runStart(SmaliApkToolsPath log) {
|
||||
private void runStart() {
|
||||
if (apkUnPackage && csjManifest) {
|
||||
start(log);
|
||||
start();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user