I wrote a module for myself to get started with xposed development when my phone (LG G2) was on Jelly Bean. I upgraded my phone to Kit Kat and noticed my module was no longer working and was firing a NoSuchMethod exception:
I checked the API and it doesn't appear that adjustStreamVolume was deprecated or changed in any way, so I'm kind of confused as to why this would be happening. Maybe it's just my ignorance of xposed development so far, but here's my code with all of meat stripped out. From what I gather, the findAndHookMethod is the problem anyway. Any assistance as to why this is no longer working would be greatly appreciated. Let me know if more details are needed.
Code:
java.lang.NoSuchMethodError: android.media.AudioService#adjustStreamVolume(int,int,int)#exact
at de.robv.android.xposed.XposedHelpers.findMethodExact(XposedHelpers.java:179)
at de.robv.android.xposed.XposedHelpers.findAndHookMethod(XposedHelpers.java:129)
at de.robv.android.xposed.XposedHelpers.findAndHookMethod(XposedHelpers.java:136)
at com.bkdev.android.xposed.mods.ringtonesync.VolumeSync.handleLoadPackage(VolumeSync.java:21)
at de.robv.android.xposed.IXposedHookLoadPackage$Wrapper.handleLoadPackage(IXposedHookLoadPackage.java:20)
at de.robv.android.xposed.callbacks.XC_LoadPackage.call(XC_LoadPackage.java:34)
at de.robv.android.xposed.callbacks.XCallback.callAll(XCallback.java:70)
at de.robv.android.xposed.XposedBridge$2.beforeHookedMethod(XposedBridge.java:228)
at de.robv.android.xposed.XposedBridge.handleHookedMethod(XposedBridge.java:611)
at com.android.server.ServerThread.initAndLoop(Native Method)
at com.android.server.SystemServer.main(SystemServer.java:1478)
at de.robv.android.xposed.XposedBridge.invokeOriginalMethodNative(Native Method)
at de.robv.android.xposed.XposedBridge.handleHookedMethod(XposedBridge.java:631)
at com.android.server.SystemServer.main(Native Method)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:792)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:608)
at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:132)
at dalvik.system.NativeStart.main(Native Method)
I checked the API and it doesn't appear that adjustStreamVolume was deprecated or changed in any way, so I'm kind of confused as to why this would be happening. Maybe it's just my ignorance of xposed development so far, but here's my code with all of meat stripped out. From what I gather, the findAndHookMethod is the problem anyway. Any assistance as to why this is no longer working would be greatly appreciated. Let me know if more details are needed.
Code:
public void handleLoadPackage(final LoadPackageParam lpparam) throws Throwable {
if (!lpparam.packageName.equals("android"))
return;
// XposedBridge.log("In com.android.media");
findAndHookMethod("android.media.AudioService", lpparam.classLoader, "adjustStreamVolume", int.class, int.class, int.class, new XC_MethodHook() {
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
XposedBridge.log("********Hooked 'adjustStreamVolume'********");
}
});
}