mirror of
https://gitee.com/replugin/RePlugin.git
synced 2024-11-30 02:38:34 +08:00
Set RePluginClassLoader to Thread's ContextClassLoader
This commit is contained in:
parent
1f7128c187
commit
7d2ce64001
@ -82,6 +82,10 @@ public class PatchClassLoaderUtils {
|
||||
// 将新的ClassLoader写入mPackageInfo.mClassLoader
|
||||
ReflectUtils.writeField(oPackageInfo, "mClassLoader", cl);
|
||||
|
||||
// 设置线程上下文中的ClassLoader为RePluginClassLoader
|
||||
// 防止在个别Java库用到了Thread.currentThread().getContextClassLoader()时,“用了原来的PathClassLoader”,或为空指针
|
||||
Thread.currentThread().setContextClassLoader(cl);
|
||||
|
||||
if (LOG) {
|
||||
Log.d(TAG, "patch: patch mClassLoader ok");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user