I'm trying to reverse an apk, overload some function and rebuild/sign it.

I should have done everything in the correct way; the only thing I edited is a function that check if the device is rooted. The function is isRooted and it calls other 3 functions:

  public static boolean isRooted()
    return (checkRootMethod1()) || (checkRootMethod2()) || (checkRootMethod3());

I tried to change the "smali-version" of this function in that way:

.method public static isRooted()Z
    .locals 1

    .line 15
    invoke-static {}, Lcom/name1/name2/CtrlDevice;->checkRootMethod1()Z

    move-result v0

    if-nez v0, :cond_0

    invoke-static {}, Lcom/name1/name2/CtrlDevice;->checkRootMethod2()Z

    move-result v0

    if-nez v0, :cond_0

    invoke-static {}, Lcom/name1/name2/CtrlDevice;->checkRootMethod3()Z

    move-result v0

    if-nez v0, :cond_0

    const/4 v0, 0x0

    return v0

    const/4 v0, 0x0

    goto :goto_0
.end method

The only difference from the original version is that the cond_0 was

const/4 v0, 0x1

After that I built an APK with apktool and I signed it with jarsigner and everything seems to be ok, but when I install the app on my device and I run it, after the splash it crashes.

I know that the question is really generic and I don't want a direct solution to this problem but I would like to know if is possible to implement something like a check that prevent to run the app after something has changed. Is possible something like that? How can I skip this check?

  • 1
    This doesn't even have to be a tamper check. Imagine a global variable that gets set to 1, 2 or 3 respectively by the first checkRootMethod that succeeds. Later, your program runs one of various runAsRootMethods depending on that variable, and since the variable never got initialized, the program crashes. Commented Aug 3, 2016 at 20:57
  • 1
    An obvious suggestion - check logs for the cause of this crash. Commented Aug 4, 2016 at 6:56

1 Answer 1


Yes it is possible to have anti-tampering checks, and I have seen apps with them. That being said, you should eliminate the simplest causes first.

Did you check logcat? Most likely you accidentally screwed up the smali or otherwise messed up the apk. You should be able to see why the app crashed by checking logcat.

Another thing you should check is whether the app works if you simply resign it with no code changes.

Anyway, if it turns out that the app actually does have anti-tampering checks, you just have to reverse engineer it and disable the checks. There obviously isn't any one size fits all advice here, since anything you do is specific to the particular checks implemented.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.