Set RePluginClassLoader to Thread's ContextClassLoader

This commit is contained in:
zhangjiongxuan 2017-08-02 11:11:43 +08:00
parent 1f7128c187
commit 7d2ce64001

View File

@ -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");
}