PathClassLoader和DexClassLoader

来源:互联网 发布:百度知道与知乎 编辑:程序博客网 时间:2024/04/29 04:09

动态加载.apk.jar.dex文件而且路径不受限制

4.1之后的版本中,不允许直接加载外部jar

 final File dexOutputPath =new File(Environment.getExternalStorageDirectory().toString()        + File.separator + "dextest/Demojar-dex.jar");        File dir = this.getDir("out-dex", 0);        DexClassLoader cl = new DexClassLoader(dexOutputPath.getAbsolutePath(),        dir.getAbsolutePath(), null, getClassLoader());


0 0
原创粉丝点击