Code example for DexClassLoader

0
				clearLayoutInflateCache(); 
				mClassLoaderMap.remove(preClassLoader);
			} 
 
			String cache = mShell.getCacheDir().getCanonicalPath();
			dexClassLoader = new DexClassLoader(canonicalPath, cache, null, mShell.getClassLoader());
			 
			mClassLoaderMap.put(pluginId, dexClassLoader); // 缓存当前版本的classLoader
			mClassLoaderMap.put(packageInfo.packageName, dexClassLoader); // 缓存该插件的classLoader
		} 
				 
		// 拿到插件入口的Activity实例 
		mClassloader = dexClassLoader;
		mClassLaunchActivity =  mClassloader.loadClass(mRunningActivityName);
 
		// 先退出当前的activity 
		if ( mRunningActivity != null )
		{ 
			mRunningActivity.client_onDestroy();
		} 
		mRunningActivity = (IPluginClient) mClassLaunchActivity.newInstance();
		 
		// 初始化插件 
		mRunningActivity.client_init(canonicalPath, mShell, dexClassLoader, packageInfo, mShell.getIntent() );		
 
		// 启动插件 
		mRunningActivity.client_onCreate(null);
		 
		return true; 
Contextual code suggestions in your IDE  Get Codota for Java