Xposed模块开发Cannot load module问题
程序员文章站
2022-06-01 09:52:23
...
想开发一个修改机器型号的模块,都在VirtualXposed上成功运行机型修改,信心满满的装到已经装了xposed的真机上,结果不生效,查看log是模块加载不成功
查看log如下
06-27 14:25:56.205 I/Xposed ( 318): Found Xposed class 'de/robv/android/xposed/XposedBridge', now initializing
06-27 14:25:56.751 I/Xposed ( 318): Loading modules from /data/app/com.xposed-1/base.apk
06-27 14:25:56.934 E/Xposed ( 318): Cannot load module:
06-27 14:25:56.934 E/Xposed ( 318): The Xposed API classes are compiled into the module's APK.
06-27 14:25:56.934 E/Xposed ( 318): This may cause strange issues and must be fixed by the module developer.
06-27 14:25:56.934 E/Xposed ( 318): For details, see: http://api.xposed.info/using.html
检查了build.grade的引用应该是没有问题的
dependencies {
compileOnly 'de.robv.android.xposed:api:82'
compileOnly 'de.robv.android.xposed:api:82:sources'
implementation fileTree(dir: 'libs', include: ['*.jar'])
}
但是还是抱着试一试的想法,尝试注释掉
//implementation fileTree(dir: 'libs', include: ['*.jar'])
装到机器中发现问题解决
分析:我这边是把jar包放到libs下面的文件夹,官方文档特别写到不能使用compile,要用privode,而privode在Android Studio的3.1.4版本中换成了compileOnly,可能是后面的implementation覆盖了前面的compileOnly 发此文为记录这一个神奇的问题,暂未找到其他方式,所以目前的解决方案是如果要用到其他jar包需要手动一个个添加,不能使用filetree的方式