Xposed Not Loading我的模块,ClassNotFoundException

时间:2016-05-04 14:40:04

标签: java android xposed-framework xposed

我正在开发一个Xposed模块,作为FatMinMin minminHide module的扩展,它似乎也是一个很好的开发练习:) 问题是,在启动时,当我检查xposed日志时,我得到以下内容:

5-04 17:06:44.305 I/Xposed  (581): Loading modules from /data/app/xposed.sudocode.com.sudohide-1/base.apk
05-04 17:06:44.325 I/Xposed  (581):   Loading class xposed.sudocode.com.sudohide.XposedMain
05-04 17:06:44.326 E/Xposed  (581): java.lang.ClassNotFoundException: Didn't find class "xposed.sudocode.com.sudohide.XposedMain" on path: DexPathList[[zip file "/data/app/xposed.sudocode.com.sudohide-1/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
05-04 17:06:44.326 E/Xposed  (581):     at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
05-04 17:06:44.326 E/Xposed  (581):     at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
05-04 17:06:44.326 E/Xposed  (581):     at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
05-04 17:06:44.326 E/Xposed  (581):     at de.robv.android.xposed.XposedBridge.loadModule(XposedBridge.java:497)
05-04 17:06:44.326 E/Xposed  (581):     at de.robv.android.xposed.XposedBridge.loadModules(XposedBridge.java:457)
05-04 17:06:44.326 E/Xposed  (581):     at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:122)
05-04 17:06:44.326 E/Xposed  (581):     Suppressed: java.lang.ClassNotFoundException: Didn't find class "xposed.sudocode.com.sudohide.XposedMain" on path: DexPathList[[zip file "/system/framework/XposedBridge.jar"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
05-04 17:06:44.326 E/Xposed  (581):         at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
05-04 17:06:44.326 E/Xposed  (581):         at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
05-04 17:06:44.326 E/Xposed  (581):         at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
05-04 17:06:44.326 E/Xposed  (581):         ... 4 more
05-04 17:06:44.326 E/Xposed  (581):         Suppressed: java.lang.ClassNotFoundException: xposed.sudocode.com.sudohide.XposedMain
05-04 17:06:44.326 E/Xposed  (581):             at java.lang.Class.classForName(Native Method)
05-04 17:06:44.326 E/Xposed  (581):             at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
05-04 17:06:44.326 E/Xposed  (581):             at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
05-04 17:06:44.326 E/Xposed  (581):             at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
05-04 17:06:44.326 E/Xposed  (581):             ... 5 more
05-04 17:06:44.326 E/Xposed  (581):         Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available

这意味着Xposed无法正确加载我的模块

在xposed_init文件中,我有以下内容:

xposed.sudocode.com.sudohide.XposedMain

我还在依赖项中添加了xposed bridge api:

dependencies {
    provided files('libs/api-82.jar')
    compile 'com.android.support:appcompat-v7:23.3.0'
}

这是我的类java文件的开头:

package xposed.sudocode.com.sudohide;


import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.content.pm.ResolveInfo;
import android.os.Binder;

import java.util.ArrayList;
import java.util.List;

import de.robv.android.xposed.IXposedHookLoadPackage;
import de.robv.android.xposed.IXposedHookZygoteInit;
import de.robv.android.xposed.XC_MethodHook;
import de.robv.android.xposed.XSharedPreferences;
import de.robv.android.xposed.XposedBridge;
import de.robv.android.xposed.XposedHelpers;
import de.robv.android.xposed.callbacks.XC_LoadPackage;

public class XposedMain implements IXposedHookZygoteInit, IXposedHookLoadPackage {

任何人都可以就如何继续提供任何形式的建议,我试图寻找解决方案,但我找不到任何解决方案,也没有在xposed文档中找到任何内容

谢谢!

4 个答案:

答案 0 :(得分:12)

只需停用Instant Run

即可
  

档案 - >设置 - >构建,执行,部署 - >即时运行

否则,您的课程不会直接包含在APK中,而是通过Xposed无法处理的存根应用程序加载。

答案 1 :(得分:1)

解决了问题! 问题是在android studio上即时运行,它是在/data/local/tmp/中安装应用程序而xposed没有在该路径中找到该类。

现在我将apk推送到设备并从存储

安装

答案 2 :(得分:1)

就我而言,我忘记添加包含以下内容的 assets 文件夹: xposed_init (无扩展名)

还包含:.package.name.XposedClassWhereYouHookedStuff

例如: com.example.sampleapp.xposedclass

在目录中:AppName / app / src / main / assets

s

并且我也禁用了即时运行

答案 3 :(得分:0)

尝试将xposed api jar放在libs dir(例如项目的根目录)之外并修复gradle配置文件。