auto copy original apk to assets
This commit is contained in:
parent
2c80821646
commit
581aaf74f7
|
|
@ -215,6 +215,12 @@ public class MainCommand extends BaseCommand {
|
||||||
// compress all files into an apk and then sign it.
|
// compress all files into an apk and then sign it.
|
||||||
mXpatchTasks.add(new BuildAndSignApkTask(keepBuildFiles, unzipApkFilePath, output));
|
mXpatchTasks.add(new BuildAndSignApkTask(keepBuildFiles, unzipApkFilePath, output));
|
||||||
|
|
||||||
|
// copy origin apk to assets
|
||||||
|
// convenient to bypass some check like CRC
|
||||||
|
if(!FileUtils.copyFile(srcApkFile, new File(unzipApkFilePath, "assets/origin_apk.bin"))){
|
||||||
|
throw new IllegalStateException("orignal apk copy fail");
|
||||||
|
}
|
||||||
|
|
||||||
// excute these tasks
|
// excute these tasks
|
||||||
for (Runnable executor : mXpatchTasks) {
|
for (Runnable executor : mXpatchTasks) {
|
||||||
currentTime = System.currentTimeMillis();
|
currentTime = System.currentTimeMillis();
|
||||||
|
|
|
||||||
|
|
@ -32,8 +32,8 @@ public abstract class BaseCommand {
|
||||||
@Opt(opt = "h", longOpt = "help", hasArg = false, description = "Print this help message")
|
@Opt(opt = "h", longOpt = "help", hasArg = false, description = "Print this help message")
|
||||||
private boolean printHelp = false;
|
private boolean printHelp = false;
|
||||||
|
|
||||||
protected String remainingArgs[];
|
protected String[] remainingArgs;
|
||||||
protected String orginalArgs[];
|
protected String[] orginalArgs;
|
||||||
|
|
||||||
@Retention(value = RetentionPolicy.RUNTIME)
|
@Retention(value = RetentionPolicy.RUNTIME)
|
||||||
@Target(value = { ElementType.FIELD })
|
@Target(value = { ElementType.FIELD })
|
||||||
|
|
|
||||||
|
|
@ -125,7 +125,7 @@ public class FileUtils {
|
||||||
copyFile(new File(sourcePath), new File(targetPath));
|
copyFile(new File(sourcePath), new File(targetPath));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void copyFile(File source, File target) {
|
public static boolean copyFile(File source, File target) {
|
||||||
|
|
||||||
FileInputStream inputStream = null;
|
FileInputStream inputStream = null;
|
||||||
FileOutputStream outputStream = null;
|
FileOutputStream outputStream = null;
|
||||||
|
|
@ -146,12 +146,14 @@ public class FileUtils {
|
||||||
buffer.position(0);
|
buffer.position(0);
|
||||||
oChannel.write(buffer);
|
oChannel.write(buffer);
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} finally {
|
} finally {
|
||||||
close(inputStream);
|
close(inputStream);
|
||||||
close(outputStream);
|
close(outputStream);
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void deleteDir(File file) {
|
public static void deleteDir(File file) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue