第一次玩Xposed框架,按照多个demo的格式写了一个demo发现死活不进入
public abstract void handleLoadPackage(LoadPackageParam lpparam) throws Throwable;
方法,去/data/data/de.robv.android.xposed.installer/log/error.log查看,发现crash了
Loading modules from /data/app/com.example.xposed-1.apk Loading class com.example.xposed.Test java.lang.IllegalAccessError: Class ref in pre-verified class resolved to unexpected implementation at dalvik.system.DexFile.defineClassNative(Native Method) at dalvik.system.DexFile.defineClass(DexFile.java:222) at dalvik.system.DexFile.loadClassBinaryName(DexFile.java:215) at dalvik.system.DexPathList.findClass(DexPathList.java:322) at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:54) at java.lang.ClassLoader.loadClass(ClassLoader.java:497) at java.lang.ClassLoader.loadClass(ClassLoader.java:457) at de.robv.android.xposed.XposedBridge.loadModule(XposedBridge.java:421) at de.robv.android.xposed.XposedBridge.loadModules(XposedBridge.java:386) at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:120) at dalvik.system.NativeStart.main(Native Method)
经过查询发现Xposed框架出现java.lang.IllegalAccessError: Class ref in pre-verified class resolved to unexpected implementation问题的原因是因为XposedBridgeApi.jar需要放在lib文件夹下,然后选中jar包添加到build_path,不能放在
Android工程自带的libs中.
如果你不是在wb145230博客园看到本文,请点击查看原文.