InputStream is = this.getAssets().open("classes.jar");
String dexPath =
"/data/data/"+this.getPackageName()+"/";
FileOutputStream fos = new
FileOutputStream(dexPath + "classes.jar");
byte[] buffer = new
byte[1024];
int i =
0;
while((i=is.read(buffer))!=-1){
fos.write(buffer, 0,
i);
}
fos.flush();
fos.close();
is.close();
Log.e("test",
"111");
DexClassLoader dexClassLoader = new DexClassLoader(dexPath +
"classes.jar", dexPath, null,
this.getClassLoader().getParent());
Object currentActivityThread =
RefInvoke.invokeStaticMethod(
"android.app.ActivityThread", "currentActivityThread",
new
Class[] {}, new Object[] {});
String packageName =
this.getPackageName();
HashMap mPackages = (HashMap)
RefInvoke.getFieldOjbect(
"android.app.ActivityThread",
currentActivityThread,
"mPackages");
WeakReference wr = (WeakReference) mPackages.get(packageName);
RefInvoke.setFieldOjbect("android.app.LoadedApk", "mClassLoader",
this.getClassLoader(), dexClassLoader);
相关文章
- 02-15类加载器
- 02-15类加载器不同导致类型强制转换等报错
- 02-15利用伪类选择器与better-scroll的on事件所完成的上拉加载
- 02-159.4类的加载器(了解内容)
- 02-15【Android 逆向】Dalvik 函数抽取加壳 ( 类加载流程分析 | Class.cpp#findClassNoInit 函数 | DexFile.cpp#dexFindClass 函数分析 )
- 02-15android – 如何自定义进度加载器?
- 02-15JVM 类加载器命名空间深度解析与实例分析
- 02-15jvm性能调优实战 -58类加载器过多引发的OOM问题
- 02-15类加载器介绍
- 02-15类加载器的双亲委派原则