This commit is contained in:
Yutousama 2020-06-03 17:50:55 +08:00
parent afe1407825
commit 4c1aeed350
4 changed files with 51 additions and 28 deletions

View File

@ -1,3 +1,3 @@
Manifest-Version: 1.0 Manifest-Version: 1.0
Main-Class: com.qy.utils.CsjTools Main-Class: com.qy.ui.AppMain

View File

@ -63,6 +63,15 @@ public class AutoRandomAdSDK {
private SmaliApkToolsPath inter; private SmaliApkToolsPath inter;
private boolean isDev = false; private boolean isDev = false;
public void clear() {
if (adClass != null)
adClass.clear();
if (nowAdClass != null)
nowAdClass.clear();
if (nowAdFile != null)
nowAdFile.clear();
}
public static void main(String[] args) { public static void main(String[] args) {
// TODO Auto-generated method stub // TODO Auto-generated method stub
// new AutoRandomAdSDK(new File("JooMobAdSDK_6.1.8.jar"), "5600", "5", 1, null); // new AutoRandomAdSDK(new File("JooMobAdSDK_6.1.8.jar"), "5600", "5", 1, null);
@ -103,11 +112,13 @@ public class AutoRandomAdSDK {
public AutoRandomAdSDK() { public AutoRandomAdSDK() {
} }
private SmaliApkToolsPath batchInter; private SmaliApkToolsPath batchInter;
private JSONArray batch; private JSONArray batch;
public AutoRandomAdSDK(JSONArray batch, SmaliApkToolsPath inter) { public AutoRandomAdSDK(JSONArray batch, SmaliApkToolsPath inter) {
batchInter=inter; batchInter = inter;
this.batch=batch; this.batch = batch;
for (Object o : batch) { for (Object o : batch) {
//System.out.println("循环"); //System.out.println("循环");
final JSONObject item = (JSONObject) o; final JSONObject item = (JSONObject) o;
@ -123,10 +134,12 @@ public class AutoRandomAdSDK {
}); });
} }
} }
private int outIndex=0;
private int outIndex = 0;
private void outInter(JSONArray array) { private void outInter(JSONArray array) {
outIndex++; outIndex++;
if(batch.length()==outIndex){ if (batch.length() == outIndex) {
batchInter.smaliPath(batch.toString()); batchInter.smaliPath(batch.toString());
} }
} }
@ -446,6 +459,7 @@ public class AutoRandomAdSDK {
public void smaliPath(String path) { public void smaliPath(String path) {
// TODO Auto-generated method stub // TODO Auto-generated method stub
try { try {
smalitools.clear();
Thread.sleep(2000); Thread.sleep(2000);
outManifest(); outManifest();
File lt; File lt;
@ -479,6 +493,7 @@ public class AutoRandomAdSDK {
} }
if (inter != null) if (inter != null)
inter.smaliPath(nLt == null ? rootPath : nLt.getAbsolutePath()); inter.smaliPath(nLt == null ? rootPath : nLt.getAbsolutePath());
clear();
} catch (Exception e) { } catch (Exception e) {
// TODO: handle exception // TODO: handle exception
e.printStackTrace(); e.printStackTrace();
@ -538,7 +553,7 @@ public class AutoRandomAdSDK {
file.delete(); file.delete();
} else { } else {
moveFile(fs, key, nName+fs.getName().substring(fileName.length()), false); moveFile(fs, key, nName + fs.getName().substring(fileName.length()), false);
} }
} }
} }
@ -625,9 +640,9 @@ public class AutoRandomAdSDK {
if (packageName != null && file.getAbsolutePath().contains(packageName.replace(".", File.separator))) { if (packageName != null && file.getAbsolutePath().contains(packageName.replace(".", File.separator))) {
continue; continue;
} }
String sdkPackageName=config.isNull("regexPackage")?null:config.getString("regexPackage"); String sdkPackageName = config.isNull("regexPackage") ? null : config.getString("regexPackage");
if(sdkPackageName!=null){ if (sdkPackageName != null) {
toPath=toPath.replace(sdkPackageName.replace(".",File.separator),""); toPath = toPath.replace(sdkPackageName.replace(".", File.separator), "");
} }
if (file.isDirectory()) { if (file.isDirectory()) {
@ -645,7 +660,7 @@ public class AutoRandomAdSDK {
//boolean data = file.renameTo(new File(rootPath + toPath, file.getName())); //boolean data = file.renameTo(new File(rootPath + toPath, file.getName()));
boolean data=Tools.copyFile(file.getAbsolutePath(),rootPath + toPath,true); boolean data = Tools.copyFile(file.getAbsolutePath(), rootPath + toPath, true);
file.delete(); file.delete();
// System.out.println("移动文件:" + file.getAbsolutePath().replace(rootPath, "") + "" + (rootPath + toPath) + " > " + fileName + " " + nowAdClass.get(fileName) + " >! " + data); // System.out.println("移动文件:" + file.getAbsolutePath().replace(rootPath, "") + "" + (rootPath + toPath) + " > " + fileName + " " + nowAdClass.get(fileName) + " >! " + data);
if (nowAdClass.containsKey(fileName)) { if (nowAdClass.containsKey(fileName)) {
@ -675,11 +690,11 @@ public class AutoRandomAdSDK {
} }
private String getNewName(String name) { private String getNewName(String name) {
File file=new File(name); File file = new File(name);
String packageName=file.getAbsolutePath().replace(rootPath + File.separator + "smali" + File.separator,"").replace(file.getName(),""); String packageName = file.getAbsolutePath().replace(rootPath + File.separator + "smali" + File.separator, "").replace(file.getName(), "");
String nName = getNewNameForSrc(packageName.replace(File.separator,".")+file.getName()); String nName = getNewNameForSrc(packageName.replace(File.separator, ".") + file.getName());
if(nName.equals(packageName.replace(File.separator,".")+file.getName().replace(".smali",""))){ if (nName.equals(packageName.replace(File.separator, ".") + file.getName().replace(".smali", ""))) {
nName=getNewNameForSrc(file.getName()); nName = getNewNameForSrc(file.getName());
} }
if (nName.endsWith("[notmover]")) { if (nName.endsWith("[notmover]")) {
nName = nName.replace("[notmover]", ""); nName = nName.replace("[notmover]", "");
@ -751,9 +766,6 @@ public class AutoRandomAdSDK {
} }
} }
nowAdClass.put(clazzs.getString(i), mkdir); nowAdClass.put(clazzs.getString(i), mkdir);
for (String key : nowAdClass.keySet()) {
// System.out.println("key=" + key + " file=" + nowAdClass.get(key) + " oldFile=" + adClass.get(key));
}
} }
} }
} }

View File

@ -302,6 +302,7 @@ public class CsjTools {
apk_Path = path; apk_Path = path;
apk_res = apk_Path + File.separator + "res" + File.separator + "values"; apk_res = apk_Path + File.separator + "res" + File.separator + "values";
runStart(); runStart();
utils.clear();
} }
}); });
@ -319,6 +320,7 @@ public class CsjTools {
csj_Path = path; csj_Path = path;
csj_res = csj_Path + File.separator + "res" + File.separator + "values"; csj_res = csj_Path + File.separator + "res" + File.separator + "values";
_log.smaliPath("开始修改穿山甲"); _log.smaliPath("开始修改穿山甲");
utils.clear();
new Thread(new Runnable() { new Thread(new Runnable() {
@Override @Override
public void run() { public void run() {

View File

@ -256,6 +256,15 @@ public class SmaliUtils {
List<String> list; List<String> list;
public void clear() {
if (clazzList != null)
clazzList.clear();
if (list != null)
list.clear();
if (files != null)
files.clear();
}
public void setFilter(List<String> list) { public void setFilter(List<String> list) {
this.list = list; this.list = list;
} }