githubwing / HotXposed

xposed hotfix/dynamic load/no reboot library
231 stars 39 forks source link

English tutorial #3

Closed LennyPenny closed 6 years ago

LennyPenny commented 7 years ago

Hey I kinda figured out what this is supposed to do using google translate. I'm really excited for it!

Unfortunately I couldn't really figure out how to use it (the auto translation is really bad)

Maybe someone here is proficient in English and can write up some instructions?:)

githubwing commented 7 years ago

Hey You can try this way .

  1. Define one class for hotfix. 2.Transform your class file to dex file. 3.In the methodHook(such as a afterHookedMethod()) load class from dex file and invoke the class's metod like:
  DexFile dexFile = new DexFile(Environment.getExternalStorageDirectory()+"/classes.dex");
            Class clazz = dexFile.loadClass("net.androidwing.hotfix.HotFix",loadPackageParam.classLoader);
            clazz.getDeclaredMethod("invoke", Activity.class).invoke(null,(Activity)param.thisObject);

The code will run dynamically.

Finally hook the gradle task transformClassesWithDex for push dex file automatically.

Sorry for my bad English .

Enjoy XD

githubwing commented 6 years ago

@LennyPenny this library has updated. see the README

zjw-swun commented 6 years ago

中文说明在哪里啊?