完善自动打包程序(基本正常),缺少UI界面
穿山甲打包程序新增选择是否用应用包名选项 穿山甲配置同步
This commit is contained in:
parent
19e7e49fe7
commit
6637bfe422
@ -160,8 +160,18 @@
|
|||||||
"<activity android:name=\"com.bytedance.sdk.openadsdk.activity.TTFullScreenExpressVideoActivity\" android:configChanges=\"keyboardHidden|orientation|screenSize\" android:launchMode=\"standard\" /> ",
|
"<activity android:name=\"com.bytedance.sdk.openadsdk.activity.TTFullScreenExpressVideoActivity\" android:configChanges=\"keyboardHidden|orientation|screenSize\" android:launchMode=\"standard\" /> ",
|
||||||
"<activity android:name=\"com.bytedance.sdk.openadsdk.activity.TTDelegateActivity\" android:launchMode=\"singleTask\" android:theme=\"@android:style/Theme.Translucent.NoTitleBar\" /> ",
|
"<activity android:name=\"com.bytedance.sdk.openadsdk.activity.TTDelegateActivity\" android:launchMode=\"singleTask\" android:theme=\"@android:style/Theme.Translucent.NoTitleBar\" /> ",
|
||||||
"<service android:name=\"com.bytedance.sdk.openadsdk.multipro.aidl.BinderPoolService\" /> ",
|
"<service android:name=\"com.bytedance.sdk.openadsdk.multipro.aidl.BinderPoolService\" /> ",
|
||||||
"<receiver android:name=\"com.bytedance.embedapplog.collector.Collector\" android:enabled=\"true\" android:exported=\"true\" /> ",
|
"<receiver android:name=\"com.ss.android.downloadlib.core.download.DownloadReceiver\" android:enabled=\"true\" android:exported=\"true\" /> ",
|
||||||
"<service android:name=\"com.bytedance.tea.crash.upload.CrashUploadService\" android:process=\":npth\" />"
|
"<service android:name=\"com.bytedance.tea.crash.upload.CrashUploadService\" android:process=\":npth\" />",
|
||||||
|
|
||||||
|
"<service android:name=\"com.ss.android.socialbase.downloader.notification.DownloadNotificationService\" />",
|
||||||
|
"<service android:name=\"com.ss.android.socialbase.downloader.downloader.DownloadService\" />",
|
||||||
|
"<service android:name=\"com.ss.android.socialbase.downloader.downloader.IndependentProcessDownloadService\" android:process=\":downloader\"> <intent-filter> <action android:name=\"com.ss.android.socialbase.downloader.remote\" /> </intent-filter> </service>",
|
||||||
|
"<service android:name=\"com.ss.android.socialbase.downloader.impls.DownloadHandleService\" />",
|
||||||
|
"<service android:name=\"com.ss.android.socialbase.appdownloader.DownloadHandlerService\" />",
|
||||||
|
"<activity android:name=\"com.ss.android.socialbase.appdownloader.view.DownloadSizeLimitActivity\" android:launchMode=\"singleTask\" android:theme=\"@android:style/Theme.Dialog\" />",
|
||||||
|
"<activity android:name=\"com.ss.android.socialbase.appdownloader.view.DownloadTaskDeleteActivity\" android:launchMode=\"singleTask\" android:theme=\"@android:style/Theme.Dialog\" />",
|
||||||
|
"<activity android:name=\"com.ss.android.downloadlib.activity.TTDelegateActivity\" android:launchMode=\"singleTask\" android:theme=\"@android:style/Theme.Translucent.NoTitleBar\" />",
|
||||||
|
|
||||||
],
|
],
|
||||||
"class":[
|
"class":[
|
||||||
"com.bytedance.sdk.openadsdk.activity.TTLandingPageActivity",
|
"com.bytedance.sdk.openadsdk.activity.TTLandingPageActivity",
|
||||||
@ -175,13 +185,20 @@
|
|||||||
"com.bytedance.sdk.openadsdk.multipro.aidl.BinderPoolService",
|
"com.bytedance.sdk.openadsdk.multipro.aidl.BinderPoolService",
|
||||||
"com.bytedance.embedapplog.collector.Collector",
|
"com.bytedance.embedapplog.collector.Collector",
|
||||||
"com.bytedance.tea.crash.upload.CrashUploadService",
|
"com.bytedance.tea.crash.upload.CrashUploadService",
|
||||||
"com.bytedance.sdk.openadsdk.activity.TTBaseVideoActivity"
|
"com.bytedance.sdk.openadsdk.activity.TTBaseVideoActivity",
|
||||||
|
"com.ss.android.socialbase.downloader.notification.DownloadNotificationService",
|
||||||
|
"com.ss.android.socialbase.downloader.downloader.DownloadService",
|
||||||
|
"com.ss.android.socialbase.downloader.downloader.IndependentProcessDownloadService",
|
||||||
|
"com.ss.android.socialbase.downloader.impls.DownloadHandleService",
|
||||||
|
"com.ss.android.socialbase.appdownloader.DownloadHandlerService",
|
||||||
|
"com.ss.android.socialbase.appdownloader.view.DownloadSizeLimitActivity",
|
||||||
|
"com.ss.android.socialbase.appdownloader.view.DownloadTaskDeleteActivity",
|
||||||
|
"com.ss.android.downloadlib.activity.TTDelegateActivity"
|
||||||
],
|
],
|
||||||
"random":[
|
"random":[
|
||||||
"com",
|
"com",
|
||||||
"ww",
|
"ww",
|
||||||
"za",
|
"za",
|
||||||
"csc"
|
|
||||||
],
|
],
|
||||||
"isAllPackage":false,
|
"isAllPackage":false,
|
||||||
"isReName":true,
|
"isReName":true,
|
||||||
@ -196,6 +213,21 @@
|
|||||||
"data":" const-string v1, \".fileprovider\"\n",
|
"data":" const-string v1, \".fileprovider\"\n",
|
||||||
"end":" invoke-virtual {v2, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;",
|
"end":" invoke-virtual {v2, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;",
|
||||||
"msg":"把TTFileProvider改成fileprovider"
|
"msg":"把TTFileProvider改成fileprovider"
|
||||||
|
},{
|
||||||
|
"class":"com.bytedance.embedapplog.util.TTEncryptUtils",
|
||||||
|
"find":"const-string v0, \"tobEmbedEncrypt\"",
|
||||||
|
"data":"const-string v0, \"tob\"\n",
|
||||||
|
"end":"invoke-static {v0}, Ljava/lang/System;->loadLibrary(Ljava/lang/String;)V"
|
||||||
|
},{
|
||||||
|
"class":"com.pgl.sys.ces.a",
|
||||||
|
"find":"const-string v0, \"nms\"",
|
||||||
|
"data":"const-string v0, \"hms\"\n",
|
||||||
|
"end":"invoke-static {v0}, Ljava/lang/System;->loadLibrary(Ljava/lang/String;)V"
|
||||||
|
},{
|
||||||
|
"class":"com.pgl.sys.ces.b",
|
||||||
|
"find":"const-string p1, \"nms\"",
|
||||||
|
"data":"const-string p1, \"hms\"\n",
|
||||||
|
"end":"invoke-static {p0, p1}, Lcom/pgl/a/b/e;->a(Landroid/content/Context;Ljava/lang/String;)Z"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"rename":{
|
"rename":{
|
||||||
@ -208,9 +240,19 @@
|
|||||||
"TTFullScreenExpressVideoActivity":"{>+/activity}TTFullScreenExpressVideoActivity",
|
"TTFullScreenExpressVideoActivity":"{>+/activity}TTFullScreenExpressVideoActivity",
|
||||||
"TTDelegateActivity":"{>+/activity}TTDelegateActivity",
|
"TTDelegateActivity":"{>+/activity}TTDelegateActivity",
|
||||||
"TTBaseVideoActivity":"{>+/activity}TTBaseVideoActivity",
|
"TTBaseVideoActivity":"{>+/activity}TTBaseVideoActivity",
|
||||||
"BinderPoolService":"BinderPoolService",
|
"BinderPoolService":"{>+/multipro/aidl}BinderPoolService",
|
||||||
"Collector":"Collector",
|
"Collector":"{>+/cc/collector}Collector",
|
||||||
"CrashUploadService":"CrashUploadService"
|
"CrashUploadService":"{>+/cc/crash/upload}CrashUploadService",
|
||||||
|
"com.ss.android.downloadlib.activity.TTDelegateActivity":"{>+/dl/activity}TTDelegateActivity",
|
||||||
|
"DownloadNotificationService":"{>+/sb/downloader/notification}DownloadNotificationService",
|
||||||
|
"DownloadService":"{>+/sb/downloader/downloader}DownloadService",
|
||||||
|
"IndependentProcessDownloadService":"{>+/sb/downloader/downloader}IndependentProcessDownloadService",
|
||||||
|
"DownloadHandleService":"{>+/sb/downloader/impls}DownloadHandleService",
|
||||||
|
"DownloadHandlerService":"{>+/sb/appdownloader}DownloadHandlerService",
|
||||||
|
"DownloadSizeLimitActivity":"{>+/sb/appdownloader/view}DownloadSizeLimitActivity",
|
||||||
|
"DownloadTaskDeleteActivity":"{>+/sb/appdownloader/view}DownloadTaskDeleteActivity",
|
||||||
|
"DownloadReceiver":"{>+/dl/core/download}DownloadReceiver",
|
||||||
|
|
||||||
},
|
},
|
||||||
"filter":[
|
"filter":[
|
||||||
"com.android",
|
"com.android",
|
||||||
|
@ -103,6 +103,15 @@
|
|||||||
<text value="选择"/>
|
<text value="选择"/>
|
||||||
</properties>
|
</properties>
|
||||||
</component>
|
</component>
|
||||||
|
<component id="faddb" class="javax.swing.JCheckBox" binding="useAppPackageName">
|
||||||
|
<constraints>
|
||||||
|
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||||
|
<gridbag weightx="0.0" weighty="0.0"/>
|
||||||
|
</constraints>
|
||||||
|
<properties>
|
||||||
|
<text value="使用APP的包名"/>
|
||||||
|
</properties>
|
||||||
|
</component>
|
||||||
</children>
|
</children>
|
||||||
</grid>
|
</grid>
|
||||||
</children>
|
</children>
|
||||||
|
@ -14,6 +14,7 @@ public class ChuanShanJiaUi {
|
|||||||
private JPanel mainPanel;
|
private JPanel mainPanel;
|
||||||
private JButton selectButton;
|
private JButton selectButton;
|
||||||
private JTextArea log;
|
private JTextArea log;
|
||||||
|
private JCheckBox useAppPackageName;
|
||||||
|
|
||||||
public ChuanShanJiaUi() {
|
public ChuanShanJiaUi() {
|
||||||
selectButton.addActionListener(new ActionListener() {
|
selectButton.addActionListener(new ActionListener() {
|
||||||
@ -38,6 +39,7 @@ public class ChuanShanJiaUi {
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
CsjTools tools=new CsjTools();
|
CsjTools tools=new CsjTools();
|
||||||
|
tools.setUserPackageName(useAppPackageName.isSelected());
|
||||||
tools.build(csjDemo.getAbsolutePath(), apkFile.getAbsolutePath(), new SmaliApkToolsPath() {
|
tools.build(csjDemo.getAbsolutePath(), apkFile.getAbsolutePath(), new SmaliApkToolsPath() {
|
||||||
@Override
|
@Override
|
||||||
public void smaliPath(String path) {
|
public void smaliPath(String path) {
|
||||||
|
@ -72,6 +72,9 @@ public class AutoPackageSDK {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
outAssetsQY(0, "0");
|
||||||
|
outAssetsQY(1, "4");
|
||||||
|
outRes();
|
||||||
new AutoRandomAdSDK(array, new SmaliApkToolsPath() {
|
new AutoRandomAdSDK(array, new SmaliApkToolsPath() {
|
||||||
@Override
|
@Override
|
||||||
public void smaliPath(String path) {
|
public void smaliPath(String path) {
|
||||||
@ -79,11 +82,7 @@ public class AutoPackageSDK {
|
|||||||
delete(gdtPath,gdtsdk);
|
delete(gdtPath,gdtsdk);
|
||||||
delete(unplayPath,uniplaysdk);
|
delete(unplayPath,uniplaysdk);
|
||||||
delete(qysdkPath,qysdk);
|
delete(qysdkPath,qysdk);
|
||||||
|
|
||||||
outAssetsADS(path);
|
outAssetsADS(path);
|
||||||
outAssetsQY(0, "0");
|
|
||||||
outAssetsQY(1, "4");
|
|
||||||
outRes();
|
|
||||||
copy();
|
copy();
|
||||||
zip();
|
zip();
|
||||||
System.out.println("制作SDK完成");
|
System.out.println("制作SDK完成");
|
||||||
@ -97,6 +96,7 @@ public class AutoPackageSDK {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void outAssetsQY(int index, String type) {
|
private void outAssetsQY(int index, String type) {
|
||||||
@ -183,21 +183,22 @@ public class AutoPackageSDK {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private void zip(File file,OutputStream stream) throws Exception {
|
private void zip(File file) throws Exception {
|
||||||
|
String cd = "cd " + new File("packageSDK").getAbsolutePath();
|
||||||
File sdk = new File("packageSDK" + File.separator + "sdk.aar");
|
File sdk = new File("packageSDK" + File.separator + "sdk.aar");
|
||||||
File files=new File("packageSDK");
|
File files=new File("packageSDK");
|
||||||
String aapt=new File("aapt.exe").exists()?new File("aapt.exe").getAbsolutePath():"aapt";
|
String aapt=new File("aapt.exe").exists()?new File("aapt.exe").getAbsolutePath():"aapt";
|
||||||
for (File listFile : file.listFiles()) {
|
for (File listFile : file.listFiles()) {
|
||||||
if(listFile.isDirectory()){
|
if(listFile.isDirectory()){
|
||||||
zip(listFile,stream);
|
zip(listFile);
|
||||||
}else if(!listFile.getName().equals("sdk.aar")){
|
}else if(!listFile.getName().equals("sdk.aar")){
|
||||||
String path=listFile.getAbsolutePath().replace(files.getAbsolutePath(),"");
|
String path=listFile.getAbsolutePath().replace(files.getAbsolutePath(),"");
|
||||||
String exec=aapt+" r "+sdk.getAbsolutePath()+" "+path.substring(1)+"\n";
|
String exec=aapt+" r "+sdk.getAbsolutePath()+" "+path.substring(1)+"\n";
|
||||||
stream.write(exec.getBytes());
|
Runtime.getRuntime().exec("cmd /c "+cd+" && "+exec);
|
||||||
stream.flush();
|
Thread.sleep(100);
|
||||||
exec =aapt+ " a " + sdk.getAbsolutePath() + " " + path.substring(1) + "\n";
|
exec =aapt+ " a " + sdk.getAbsolutePath() + " " + path.substring(1) + "\n";
|
||||||
stream.write(exec.getBytes());
|
Runtime.getRuntime().exec("cmd /c "+cd+" && "+exec);
|
||||||
stream.flush();
|
Thread.sleep(100);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -206,17 +207,20 @@ public class AutoPackageSDK {
|
|||||||
try {
|
try {
|
||||||
Tools.copyFile(new File("input" + File.separator + "Documents" + File.separator + "sdk.aar").getAbsolutePath(),
|
Tools.copyFile(new File("input" + File.separator + "Documents" + File.separator + "sdk.aar").getAbsolutePath(),
|
||||||
new File("packageSDK").getAbsolutePath(), true);
|
new File("packageSDK").getAbsolutePath(), true);
|
||||||
String cd = "cd " + new File("packageSDK").getAbsolutePath() + "\n";
|
String cd = "cd " + new File("packageSDK").getAbsolutePath() + "\n\r";
|
||||||
Process process=Runtime.getRuntime().exec(new String[]{"cmd"});
|
Process process=Runtime.getRuntime().exec(new String[]{"cmd"});
|
||||||
OutputStream stream =process.getOutputStream();
|
OutputStream stream =process.getOutputStream();
|
||||||
stream.write(cd.getBytes());
|
stream.write(cd.getBytes());
|
||||||
stream.flush();
|
stream.flush();
|
||||||
zip(new File("packageSDK"),stream);
|
stream.close();
|
||||||
|
process.destroy();
|
||||||
|
zip(new File("packageSDK"));
|
||||||
File copy=new File("packageSDK"+File.separator+"copy");
|
File copy=new File("packageSDK"+File.separator+"copy");
|
||||||
if(copy.exists()){
|
if(copy.exists()){
|
||||||
zip(copy,stream);
|
zip(copy);
|
||||||
}
|
}
|
||||||
stream.close();
|
stream.close();
|
||||||
|
process.destroy();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@ -238,6 +242,6 @@ public class AutoPackageSDK {
|
|||||||
public void smaliPath(String path) {
|
public void smaliPath(String path) {
|
||||||
//com.tanggttaxc.langtt.mi
|
//com.tanggttaxc.langtt.mi
|
||||||
}
|
}
|
||||||
}, "5700", a==0?"com.luckyboy.mmxing":"danxian.popstar");
|
}, "5700", a==0?"com.luckyboy.mmxing":"com.prujwk.jdyphn");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -212,7 +212,6 @@ public class AutoRandomAdSDK {
|
|||||||
for (String str : packagename.split("\\.")) {
|
for (String str : packagename.split("\\.")) {
|
||||||
array.put(str);
|
array.put(str);
|
||||||
}
|
}
|
||||||
array.put("csc");
|
|
||||||
config.put("random", array);
|
config.put("random", array);
|
||||||
rootPath = path;
|
rootPath = path;
|
||||||
sdktype = "13";
|
sdktype = "13";
|
||||||
@ -255,7 +254,6 @@ public class AutoRandomAdSDK {
|
|||||||
array.put(manifest.getString(i).replace(key, newManifest.replace(".smali", "")));
|
array.put(manifest.getString(i).replace(key, newManifest.replace(".smali", "")));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// TODO: handle exception
|
// TODO: handle exception
|
||||||
e.printStackTrace();
|
|
||||||
//System.out.println("-------->" + adClass.size());
|
//System.out.println("-------->" + adClass.size());
|
||||||
for (String keys : adClass.keySet()) {
|
for (String keys : adClass.keySet()) {
|
||||||
//System.out.println(keys + " " + adClass.get(keys));
|
//System.out.println(keys + " " + adClass.get(keys));
|
||||||
@ -276,7 +274,7 @@ public class AutoRandomAdSDK {
|
|||||||
writer.flush();
|
writer.flush();
|
||||||
}
|
}
|
||||||
writer.close();
|
writer.close();
|
||||||
} catch (FileNotFoundException e) {
|
} catch (Exception e) {
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@ -380,7 +378,7 @@ public class AutoRandomAdSDK {
|
|||||||
writer.write(buffer.toString());
|
writer.write(buffer.toString());
|
||||||
writer.flush();
|
writer.flush();
|
||||||
writer.close();
|
writer.close();
|
||||||
out();
|
|
||||||
reader.close();
|
reader.close();
|
||||||
// Desktop.getDesktop().open(file);
|
// Desktop.getDesktop().open(file);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
@ -404,6 +402,7 @@ public class AutoRandomAdSDK {
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
out();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void show(File file) {
|
private void show(File file) {
|
||||||
@ -503,9 +502,9 @@ public class AutoRandomAdSDK {
|
|||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
for (String key : nowAdClass.keySet()) {
|
/* for (String key : nowAdClass.keySet()) {
|
||||||
System.out.println("key=" + key + " file=" + nowAdClass.get(key) + " oldFile=" + adClass.get(key));
|
System.out.println("key=" + key + " file=" + nowAdClass.get(key) + " oldFile=" + adClass.get(key));
|
||||||
}
|
}*/
|
||||||
for (String key : adClass.keySet()) {
|
for (String key : adClass.keySet()) {
|
||||||
File file = new File(adClass.get(key).getAbsolutePath());
|
File file = new File(adClass.get(key).getAbsolutePath());
|
||||||
String fileName = file.getName().replace(".smali", "");
|
String fileName = file.getName().replace(".smali", "");
|
||||||
@ -513,8 +512,8 @@ public class AutoRandomAdSDK {
|
|||||||
if (!config.getBoolean("isAllPackage")) {
|
if (!config.getBoolean("isAllPackage")) {
|
||||||
filePath = new File(file.getAbsolutePath().replace(file.getName(), ""));
|
filePath = new File(file.getAbsolutePath().replace(file.getName(), ""));
|
||||||
}
|
}
|
||||||
System.out.println(nowAdClass.get(key)+" "+file.getName()+" "+filePath.getAbsolutePath());
|
//System.out.println(nowAdClass.get(key)+" "+file.getName()+" "+filePath.getAbsolutePath());
|
||||||
// System.out.println(key + " | " + file.getAbsolutePath() + " | " + fileName + " | " + filePath.getAbsolutePath());
|
//System.out.println(key + " | " + file.getAbsolutePath() + " | " + fileName + " | " + filePath.getAbsolutePath());
|
||||||
if (filePath.listFiles() == null) {
|
if (filePath.listFiles() == null) {
|
||||||
//System.out.println("filePath为空:" + filePath.getAbsolutePath());
|
//System.out.println("filePath为空:" + filePath.getAbsolutePath());
|
||||||
//System.out.println(file.getAbsolutePath());
|
//System.out.println(file.getAbsolutePath());
|
||||||
@ -529,10 +528,10 @@ public class AutoRandomAdSDK {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
String nName = getNewName(fs.getName());
|
String nName = getNewName(fs.getAbsolutePath());
|
||||||
if (fs.getName().startsWith(fileName + "$")) {
|
if (fs.getName().startsWith(fileName.split("\\$")[0] + "$")) {
|
||||||
if (getNewName(fs.getName()).endsWith("[notmover]")) {
|
if (getNewName(fs.getAbsolutePath()).endsWith("[notmover]")) {
|
||||||
Tools.copyFileToName(fs.getAbsolutePath(), fs.getAbsolutePath(), fs
|
Tools.copyFileToName(fs.getAbsolutePath(), fs.getAbsolutePath(), fs
|
||||||
.getName().replace(fs.getName().split("\\$")[0], nName), true);
|
.getName().replace(fs.getName().split("\\$")[0], nName), true);
|
||||||
} else {
|
} else {
|
||||||
moveFile(fs, key, fs.getName().replace(fs.getName().split("\\$")[0], nName), false);
|
moveFile(fs, key, fs.getName().replace(fs.getName().split("\\$")[0], nName), false);
|
||||||
@ -543,9 +542,9 @@ public class AutoRandomAdSDK {
|
|||||||
if (getNewNameForSrc(file.getName()).endsWith("[notmover]")) {
|
if (getNewNameForSrc(file.getName()).endsWith("[notmover]")) {
|
||||||
nowAdFile.put(key, file.getAbsolutePath());
|
nowAdFile.put(key, file.getAbsolutePath());
|
||||||
Tools.copyFileToName(file.getAbsolutePath(), file.getAbsolutePath().replace(file.getName(), ""),
|
Tools.copyFileToName(file.getAbsolutePath(), file.getAbsolutePath().replace(file.getName(), ""),
|
||||||
getNewName(file.getName()) + ".smali", true);
|
getNewName(file.getAbsolutePath()) + ".smali", true);
|
||||||
} else {
|
} else {
|
||||||
moveFile(file, key, getNewName(file.getName()) + ".smali", true);
|
moveFile(file, key, getNewName(file.getAbsolutePath()) + ".smali", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
file.delete();
|
file.delete();
|
||||||
@ -561,10 +560,10 @@ public class AutoRandomAdSDK {
|
|||||||
moveFile(file, key);
|
moveFile(file, key);
|
||||||
} else {
|
} else {
|
||||||
if (file.getName().startsWith("TMProvider")) {
|
if (file.getName().startsWith("TMProvider")) {
|
||||||
//System.out.println("移动文件:" + file.getName() + " -> " + getNewName(file.getName()) + " | " + fileName);
|
//System.out.println("移动文件:" + file.getName() + " -> " + getNewName(file.getAbsolutePath()) + " | " + fileName);
|
||||||
}
|
}
|
||||||
// //System.out.println("移动文件:"+path.getName()+" -> "+getNewName(path.getName()));
|
// //System.out.println("移动文件:"+path.getName()+" -> "+getNewName(path.getName()));
|
||||||
moveFile(file, key, getNewName(path.getName()) + ".smali", false);
|
moveFile(file, key, getNewName(path.getAbsolutePath()) + ".smali", false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -597,7 +596,7 @@ public class AutoRandomAdSDK {
|
|||||||
boolean t = Tools.copyFileToName(file.getAbsolutePath(), path,
|
boolean t = Tools.copyFileToName(file.getAbsolutePath(), path,
|
||||||
nName, true);
|
nName, true);
|
||||||
file.delete();
|
file.delete();
|
||||||
////System.out.println("移动文件:" + file.getAbsolutePath() + " 到" + path + " 重命名为:" + nName + " 结果" + t);
|
//System.err.println("移动文件:" + file.getAbsolutePath() + " 到" + path + " 重命名为:" + nName + " 结果" + t);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void allpackage(File file, String packge) {
|
private void allpackage(File file, String packge) {
|
||||||
@ -612,7 +611,7 @@ public class AutoRandomAdSDK {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
//穿山甲视频会闪退
|
|
||||||
private void movesdk(File path, String toPath) {
|
private void movesdk(File path, String toPath) {
|
||||||
for (File file : path.listFiles()) {
|
for (File file : path.listFiles()) {
|
||||||
if (file.getName().equals("BuildConfig.smali")) {
|
if (file.getName().equals("BuildConfig.smali")) {
|
||||||
@ -670,10 +669,16 @@ public class AutoRandomAdSDK {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private String getNewName(String name) {
|
private String getNewName(String name) {
|
||||||
String nName = getNewNameForSrc(name);
|
File file=new File(name);
|
||||||
|
String packageName=file.getAbsolutePath().replace(rootPath + File.separator + "smali" + File.separator,"").replace(file.getName(),"");
|
||||||
|
String nName = getNewNameForSrc(packageName.replace(File.separator,".")+file.getName());
|
||||||
|
if(nName.equals(packageName.replace(File.separator,".")+file.getName().replace(".smali",""))){
|
||||||
|
nName=getNewNameForSrc(file.getName());
|
||||||
|
}
|
||||||
if (nName.endsWith("[notmover]")) {
|
if (nName.endsWith("[notmover]")) {
|
||||||
nName = nName.replace("[notmover]", "");
|
nName = nName.replace("[notmover]", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
return nName;
|
return nName;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -685,6 +690,7 @@ public class AutoRandomAdSDK {
|
|||||||
String tmpName;
|
String tmpName;
|
||||||
String wName = null;
|
String wName = null;
|
||||||
name = name.replace(".smali", "");
|
name = name.replace(".smali", "");
|
||||||
|
|
||||||
if (name.contains("$")) {
|
if (name.contains("$")) {
|
||||||
tmpName = name.split("$")[0];
|
tmpName = name.split("$")[0];
|
||||||
for (String t : name.split("$")) {
|
for (String t : name.split("$")) {
|
||||||
|
@ -66,14 +66,21 @@ public class CsjTools {
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
private boolean isAppPackageName =false;
|
||||||
|
public void setUserPackageName(boolean isAppPackageName){
|
||||||
|
this.isAppPackageName=isAppPackageName;
|
||||||
|
}
|
||||||
private String getPackageName() {
|
private String getPackageName() {
|
||||||
try {
|
try {
|
||||||
File apkManifest = new File(apk_Path + File.separator + "AndroidManifest.xml");
|
if(isAppPackageName) {
|
||||||
BufferedReader reader = new BufferedReader(new FileReader(apkManifest));
|
File apkManifest = new File(apk_Path + File.separator + "AndroidManifest.xml");
|
||||||
String tmp = reader.readLine();
|
BufferedReader reader = new BufferedReader(new FileReader(apkManifest));
|
||||||
reader.close();
|
String tmp = reader.readLine();
|
||||||
return getXMLValue("package", tmp);
|
reader.close();
|
||||||
|
return getXMLValue("package", tmp);
|
||||||
|
}else{
|
||||||
|
return "com.prujwk.jdyphn";
|
||||||
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@ -240,15 +247,18 @@ public class CsjTools {
|
|||||||
_log = log;
|
_log = log;
|
||||||
unPackageCSJ = false;
|
unPackageCSJ = false;
|
||||||
File csjFile = new File(csjPath);
|
File csjFile = new File(csjPath);
|
||||||
if (new File(csjFile.getName().replace(".apk", "")).exists()) {
|
//由于改成动态SDK,所以每个应用都要单独打包
|
||||||
|
/*if (new File(csjFile.getName().replace(".apk", "")).exists()) {
|
||||||
System.out.println(">?>>" + new File(csjFile.getName().replace(".apk", "")).getAbsolutePath());
|
System.out.println(">?>>" + new File(csjFile.getName().replace(".apk", "")).getAbsolutePath());
|
||||||
unPackageCSJ = true;
|
unPackageCSJ = true;
|
||||||
csj_Path = new File(csjFile.getName().replace(".apk", "")).getAbsolutePath();
|
csj_Path = new File(csjFile.getName().replace(".apk", "")).getAbsolutePath();
|
||||||
csj_res = csj_Path + File.separator + "res" + File.separator + "values";
|
csj_res = csj_Path + File.separator + "res" + File.separator + "values";
|
||||||
}
|
}*/
|
||||||
SmaliUtils utils = new SmaliUtils();
|
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(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(apkPath).getName().replace(".apk", File.separator));
|
||||||
|
|
||||||
|
|
||||||
new Thread(new Runnable() {
|
new Thread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
@ -55,9 +55,10 @@ public class Tools {
|
|||||||
File srcFile = new File(srcFileName);
|
File srcFile = new File(srcFileName);
|
||||||
// 判断源文件是否存在
|
// 判断源文件是否存在
|
||||||
if (!srcFile.exists()) {
|
if (!srcFile.exists()) {
|
||||||
|
System.err.println("源文件不存在:"+srcFile.getAbsolutePath());
|
||||||
return false;
|
return false;
|
||||||
} else if (!srcFile.isFile()) {
|
} else if (!srcFile.isFile()) {
|
||||||
|
System.err.println("源文件是目录:"+srcFile.getAbsolutePath());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,12 +67,9 @@ public class Tools {
|
|||||||
// 如果目标文件所在目录不存在,则创建目录
|
// 如果目标文件所在目录不存在,则创建目录
|
||||||
if (!destFile.exists()) {
|
if (!destFile.exists()) {
|
||||||
// 目标文件所在目录不存在
|
// 目标文件所在目录不存在
|
||||||
boolean t=destFile.mkdirs();
|
|
||||||
if(srcFileName.equals("Activity.smali")){
|
|
||||||
System.out.println("创建文件夹:"+destFileName+" "+t);
|
|
||||||
}
|
|
||||||
if (!destFile.mkdirs()) {
|
if (!destFile.mkdirs()) {
|
||||||
// 复制文件失败:创建目标文件所在目录失败
|
// 复制文件失败:创建目标文件所在目录失败
|
||||||
|
System.err.println("创建文件夹失败");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user