ClassLoader家族

DexClassLoader可以加载外部的dex,而PathClassLoader只能加载内部的dex

双亲委托

ClassLoader(ClassLoader parentLoader,boolean nullAllowed){
       if(parentLoader == null && !nullAllowed){
               throw new NullPointerException("parentLoader == null && !nullAllowed");
       }  
       parent = parentLoader;
}   

双亲委托的意义是为了性能,每次加载都会消耗时间,但如果父亲加载过,就可以直接拿来使用了

1.混淆会将app中用不到的方法全部删除

2.android 5.0修复了方法数65536的爆棚问题

3.classes.dex为主dex,使用PathClassLoader进行加载,而classes2.dex和classes3.dex这些子dex,在app启动后会使用DexClassLoader进行加载

猜你喜欢

转载自www.cnblogs.com/anni-qianqian/p/10085135.html