穿山甲资源包生成 API化
This commit is contained in:
parent
85eec17ee6
commit
9c41ab000b
@ -1,3 +1,3 @@
|
||||
Manifest-Version: 1.0
|
||||
Main-Class: com.qy.ui.AppMain
|
||||
Main-Class: com.qy.utils.CsjTools
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
package com.qy.utils;
|
||||
|
||||
import com.qy.Interfaces.SmaliApkToolsPath;
|
||||
import com.qy.ui.EditToDalog;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONObject;
|
||||
|
||||
@ -16,10 +15,29 @@ public class CsjTools {
|
||||
private static String apk_Path = "D:\\IdeaProjects\\android_sdk_tools\\app-release";
|
||||
private static String csj_Path = "D:\\IdeaProjects\\android_sdk_tools\\demo_2.8.0.2";
|
||||
private List<String> r_list;
|
||||
private String packageName = null;
|
||||
|
||||
public CsjTools() {
|
||||
}
|
||||
|
||||
public CsjTools(String apkFile, String csjFile, String packageName, String version, SmaliApkToolsPath toolsPath) {
|
||||
setUserPackageName(false);
|
||||
this.packageName = packageName;
|
||||
build(csjFile, apkFile, new SmaliApkToolsPath() {
|
||||
@Override
|
||||
public void smaliPath(String path) {
|
||||
System.out.println(path);
|
||||
if(path.startsWith("已出包")) {
|
||||
out(path.replace("已出包", ""),
|
||||
new File("csj").getAbsolutePath() + File.separator + "csc",
|
||||
Integer.parseInt(version));
|
||||
toolsPath.smaliPath(new File("csj").getAbsolutePath() + File.separator + "csc");
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public String loadXml(String path) {
|
||||
File file = new File(path);
|
||||
String xml = null;
|
||||
@ -66,19 +84,22 @@ public class CsjTools {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
private boolean isAppPackageName =false;
|
||||
public void setUserPackageName(boolean isAppPackageName){
|
||||
this.isAppPackageName=isAppPackageName;
|
||||
|
||||
private boolean isAppPackageName = false;
|
||||
|
||||
public void setUserPackageName(boolean isAppPackageName) {
|
||||
this.isAppPackageName = isAppPackageName;
|
||||
}
|
||||
|
||||
private String getPackageName() {
|
||||
try {
|
||||
if(isAppPackageName) {
|
||||
if (isAppPackageName) {
|
||||
File apkManifest = new File(apk_Path + File.separator + "AndroidManifest.xml");
|
||||
BufferedReader reader = new BufferedReader(new FileReader(apkManifest));
|
||||
String tmp = reader.readLine();
|
||||
reader.close();
|
||||
return getXMLValue("package", tmp);
|
||||
}else{
|
||||
} else {
|
||||
return "com.prujwk.jdyphn";
|
||||
}
|
||||
} catch (Exception e) {
|
||||
@ -325,30 +346,16 @@ public class CsjTools {
|
||||
|
||||
//还有最后一个问题,穿山甲的Activity没改
|
||||
public static void main(String[] args) {
|
||||
CsjTools tools = new CsjTools();
|
||||
tools.build("D:\\IdeaProjects\\android_sdk_tools\\demo_2.8.0.2.apk",
|
||||
"D:\\IdeaProjects\\android_sdk_tools\\app-release.apk",
|
||||
new SmaliApkToolsPath() {
|
||||
@Override
|
||||
public void smaliPath(String log) {
|
||||
System.out.println(log);
|
||||
if (log.startsWith("已出包")) {
|
||||
System.out.println("打包完成");
|
||||
new EditToDalog("成功", "打包完成,请输入版本号", "5600", new SmaliApkToolsPath() {
|
||||
@Override
|
||||
public void smaliPath(String path) {
|
||||
System.out.println(">>" + path);
|
||||
tools.out(log.replace("已出包", ""),
|
||||
new File("csj").getAbsolutePath() + File.separator + "csc",
|
||||
Integer.parseInt(path));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// tools.outManifest();
|
||||
// tools.start();
|
||||
new CsjTools("C:\\Users\\58381\\Documents\\WeChat Files\\z583819556\\FileStorage\\File\\2020-04\\CasualGame-release.apk"
|
||||
, "E:\\idea\\android_sdk_tools\\input\\csjDemo\\demo_2.9.0.0.apk"
|
||||
, "com.abc.test"
|
||||
, "5700"
|
||||
, new SmaliApkToolsPath() {
|
||||
@Override
|
||||
public void smaliPath(String path) {
|
||||
System.out.println("打包完成:"+path);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user