rovo89 / XposedBridge

The Java part of the Xposed framework.
3.91k stars 1.1k forks source link

What means "File does not exist" in log after loading of module? #165

Closed zumm closed 7 years ago

zumm commented 7 years ago

Hi. I try to implement simple module for xposed, but periodically i get error "File does not exist" in xposed log after line "Loading modules from /path/to/my.apk". This error occurs after updating of my module.

For example, i have simple code with one method "handleLoadPackage". I add here line:

findAndHookMethod("android.net.wifi.WifiInfo", parameter.classLoader, "getMacAddress", XC_MethodReplacement.returnConstant("AA:AA:AA:AA:AA:AA"));

It works. Next i add line:

findAndHookMethod("android.net.wifi.WifiInfo", parameter.classLoader, "hasRealMacAddress", XC_MethodReplacement.returnConstant(true));

It does not work (i get that error). I delete first line. It works again. I again add first line. It works... Also i have same problem with other code.

P.S.: I have disabled all other modules. My phone is Fly FS407 with Android 6.0. Xposed version is 87.

zumm commented 7 years ago

Additional sample calling this error:

package pro.zumm.xanonymous;

import de.robv.android.xposed.IXposedHookLoadPackage;
import de.robv.android.xposed.XposedBridge;
import de.robv.android.xposed.XposedHelpers;
import de.robv.android.xposed.callbacks.XC_LoadPackage.LoadPackageParam;

public class XAnonymous implements IXposedHookLoadPackage
{
    public
    void handleLoadPackage(final LoadPackageParam parameter) throws Throwable
    {
        if(null != XposedHelpers.findMethodExactIfExists("pro.zumm.xanonymous.XAnonymous", parameter.classLoader, "test", String.class))
        {
            XposedBridge.log("Method found in " + parameter.packageName);
        }
    }

    public
    void test(String test)
    {

    }
}
zumm commented 7 years ago

Regular situation - i waste a few days due some problem, i despair and create report of issue in web, one moment later i find solve of my problem myself.

This problem occurs due unsuitable installing APK via Android Studio. Simple solve is uninstall APK and reinstall it manually (i did it with adb) for each update.

wanam commented 7 years ago

Disable "instant run" on AS.

zumm commented 7 years ago

@wanam, yep i read tutorial and i did it right after installation of AS, but it did not help.

rovo89 commented 7 years ago

The Instant Run error would show up differently, it should actually mentioned that the feature needs to be disabled.

The reason for File not found is usually that you're too impatient. When an app gets updated, its path changes. Xposed Installer listens to these events, but it might take a few seconds until they're processed. Make sure that the "updating module list" toast pops up before you reboot. You might have also limited the permissions for Xposed Installer so that it doesn't get the broadcast at all. Third option would be that your app isn't installed on internal space, but in a path that's not accessible at boot.