android dexclassloader类加载器

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);

android dexclassloader类加载器,,5-wow.com

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。