com.faker.android.TargetDexPacker Maven / Gradle / Ivy
The newest version!
package com.faker.android;
import com.faker.android.paker.Packer;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import brut.androidlib.meta.MetaInfo;
import brut.directory.ExtFile;
public class TargetDexPacker {
public static void main(String[] args) throws Exception {
System.out.println("-------");
File smalis = new File("C:\\Users\\Yang\\Desktop\\FakerAndroidGradle\\app\\src\\main\\smalis");
File assets = new File("C:\\Users\\Yang\\Desktop\\FakerAndroidGradle\\app\\src\\main\\assets");
File baseJava = new File("C:\\Users\\Yang\\Desktop\\FakerAndroidGradle\\app\\src\\main\\java");
File apktoolYaml = new File("C:\\Users\\Yang\\Desktop\\FakerAndroidGradle\\app\\src\\main","apktool.yml");
String aplicationId = "com.vivo.demo";
File pakerFile = new File(assets,"target.dfk");
packDex(smalis, assets, baseJava, apktoolYaml, aplicationId, pakerFile);
}
public static void packDex(File smalis, File dexBuildTmpDir, File baseJava, File apktoolYaml, String aplicationId, File pakerFile) throws Exception {
Packer packer = new Packer(pakerFile);
File smaliDirs[] = smalis.listFiles();
MetaInfo metaInfo = null;
try {
metaInfo = MetaInfo.load(new FileInputStream(apktoolYaml));
} catch (FileNotFoundException ex) {
ex.printStackTrace();
}
int index = 1;
for ( int i=0;i classExclusionList = new ArrayList<>();
classExclusionList.add(new JavaSrcExclusion(baseJava));
classExclusionList.add(new RClassExclusion(aplicationId));
SmaliBuilder.build(extFile,dexFile,targetSdkVersion,classExclusionList);
index++;
try {
packer.addFile(dexFile.getName(),dexFile);
} catch (IOException ex) {
ex.printStackTrace();
}
}
packer.saveToPath();
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy