刚刚接触Xposed,感觉牛掰得不要不要得,简单写个demo后发现无效果,查看Xposed提示日志如下:
05-15 10:34:38.974 I/Xposed ( 9022): -----------------
05-15 10:34:38.974 I/Xposed ( 9022): Starting Xposed version 89, compiled for SDK 23
05-15 10:34:38.974 I/Xposed ( 9022): Device: Nexus 5X (LGE), Android version 6.0.1 (SDK 23)
05-15 10:34:38.974 I/Xposed ( 9022): ROM: MMB29P
05-15 10:34:38.974 I/Xposed ( 9022): Build fingerprint: google/bullhead/bullhead:6.0.1/MMB29P/2473553:user/release-keys
05-15 10:34:38.974 I/Xposed ( 9022): Platform: arm64-v8a, 64-bit binary, system server: yes
05-15 10:34:38.974 I/Xposed ( 9022): SELinux enabled: yes, enforcing: yes
05-15 10:34:41.430 I/Xposed ( 9022): -----------------
05-15 10:34:41.430 I/Xposed ( 9022): Added Xposed (/system/framework/XposedBridge.jar) to CLASSPATH
05-15 10:34:41.538 I/Xposed ( 9022): Detected ART runtime
05-15 10:34:41.542 I/Xposed ( 9022): Found Xposed class 'de/robv/android/xposed/XposedBridge', now initializing
05-15 10:34:41.764 I/Xposed ( 9022): Loading modules from /data/app/com.xposeddemo-1/base.apk
05-15 10:34:41.774 I/Xposed ( 9022): Loading class com.xposeddemo.xposed.XposedInit
05-15 10:34:41.775 E/Xposed ( 9022): Failed to load class com.xposeddemo.xposed.XposedInit
05-15 10:34:41.775 E/Xposed ( 9022): java.lang.ClassNotFoundException: Didn't find class "com.xposeddemo.xposed.XposedInit" on path: DexPathList[[zip file "/data/app/com.xposeddemo-1/base.apk"],nativeLibraryDirectories=[/vendor/lib64, /system/lib64]]
05-15 10:34:41.775 E/Xposed ( 9022): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
05-15 10:34:41.775 E/Xposed ( 9022): at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
05-15 10:34:41.775 E/Xposed ( 9022): at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
05-15 10:34:41.775 E/Xposed ( 9022): at de.robv.android.xposed.XposedInit.loadModule(XposedInit.java:536)
05-15 10:34:41.775 E/Xposed ( 9022): at de.robv.android.xposed.XposedInit.loadModules(XposedInit.java:466)
05-15 10:34:41.775 E/Xposed ( 9022): at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:96)
05-15 10:34:41.775 E/Xposed ( 9022): Suppressed: java.lang.ClassNotFoundException: Didn't find class "com.xposeddemo.xposed.XposedInit" on path: DexPathList[[zip file "/system/framework/XposedBridge.jar"],nativeLibraryDirectories=[/vendor/lib64, /system/lib64]]
05-15 10:34:41.775 E/Xposed ( 9022): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
05-15 10:34:41.775 E/Xposed ( 9022): at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
05-15 10:34:41.775 E/Xposed ( 9022): at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
05-15 10:34:41.775 E/Xposed ( 9022): ... 4 more
05-15 10:34:41.775 E/Xposed ( 9022): Suppressed: java.lang.ClassNotFoundException: Didn't find class "com.xposeddemo.xposed.XposedInit" on path: DexPathList[[dex file "/data/dalvik-cache/xposed_XResourcesSuperClass.dex", dex file "/data/dalvik-cache/xposed_XTypedArraySuperClass.dex"],nativeLibraryDirectories=[/vendor/lib64, /system/lib64]]
05-15 10:34:41.775 E/Xposed ( 9022): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
05-15 10:34:41.775 E/Xposed ( 9022): at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
05-15 10:34:41.775 E/Xposed ( 9022): at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
05-15 10:34:41.775 E/Xposed ( 9022): ... 5 more
05-15 10:34:41.775 E/Xposed ( 9022): Suppressed: java.lang.ClassNotFoundException: com.xposeddemo.xposed.XposedInit
05-15 10:34:41.775 E/Xposed ( 9022): at java.lang.Class.classForName(Native Method)
05-15 10:34:41.775 E/Xposed ( 9022): at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
05-15 10:34:41.775 E/Xposed ( 9022): at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
05-15 10:34:41.775 E/Xposed ( 9022): at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
05-15 10:34:41.775 E/Xposed ( 9022): ... 6 more
05-15 10:34:41.775 E/Xposed ( 9022): Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available
从日志中可以看出,原因如下:
Failed to load class com.xposeddemo.xposed.XposedInit
首先再LZ检查确认前期配置无误时,只能耐心用三流得英文水准结合二流得翻译工具去理解一流得Fuck English。。。
官方API地址:
https://github.com/rovo89/XposedBridge/wiki/Using-the-Xposed-Framework-API
再下面有这样一段话,如下:
Please make sure to disable Instant Run (File -> Settings -> Build, Execution, Deployment -> Instant Run), otherwise your classes aren’t included directly in the APK, but loaded via a stub application which Xposed can’t handle.
翻译后大概意思如下:
请确保禁用Instant Run(File -> Settings -> Build, Execution, Deployment -> Instant Run),否则您的类不会直接包含在APK中,而是通过Xposed无法处理的存根应用程序加载。
咆哮一句: