//asset中加密的apk文件重命名为index.html,拷贝到私有目录
//解密
//加载,执行apk中的方法
public static void handleByJava(Context context){
File copyedFile = new File(context.getFilesDir().getAbsolutePath() + "/" + "main.html");
FileUtil.copyAssetFile(context, "index.html", copyedFile.getAbsolutePath());
FileUtil.customDecryptFile(copyedFile, context.getFilesDir().toString(), "home.html", "android");
String apkPath = new File(context.getFilesDir()+"/"+"home.html").getAbsolutePath();
DexClassLoader classLoader = new DexClassLoader(apkPath, context.getFilesDir().getAbsolutePath(), null, context.getClassLoader());
if(new File(apkPath).exists()){
Log.e("xxx",apkPath+"存在");
}
try {
// 加载指定的类
Class<?> clazz = classLoader.loadClass("com.example.myapplication.Heave");
// 创建类的实例
Object heave = clazz.newInstance();
Method method = clazz.getMethod("initAF",android.conten
Java拷贝asset文件,解密,并用DexclassLoader加载执行
ClassDexLoader相关介绍
于 2024-09-09 16:03:54 首次发布

最低0.47元/天 解锁文章
5310

被折叠的 条评论
为什么被折叠?



