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.
|
||||
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
|
||||
for (Runnable executor : mXpatchTasks) {
|
||||
currentTime = System.currentTimeMillis();
|
||||
|
|
|
|||
|
|
@ -32,8 +32,8 @@ public abstract class BaseCommand {
|
|||
@Opt(opt = "h", longOpt = "help", hasArg = false, description = "Print this help message")
|
||||
private boolean printHelp = false;
|
||||
|
||||
protected String remainingArgs[];
|
||||
protected String orginalArgs[];
|
||||
protected String[] remainingArgs;
|
||||
protected String[] orginalArgs;
|
||||
|
||||
@Retention(value = RetentionPolicy.RUNTIME)
|
||||
@Target(value = { ElementType.FIELD })
|
||||
|
|
|
|||
|
|
@ -125,7 +125,7 @@ public class FileUtils {
|
|||
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;
|
||||
FileOutputStream outputStream = null;
|
||||
|
|
@ -146,12 +146,14 @@ public class FileUtils {
|
|||
buffer.position(0);
|
||||
oChannel.write(buffer);
|
||||
}
|
||||
return true;
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
close(inputStream);
|
||||
close(outputStream);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void deleteDir(File file) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue