How to run specific code in appium

As soon as I start to run the program then first its uninstall the previous apk then installs the new apk.
Can Anybody help me out if I can run the specific code where the problem is fixed instead the launching new apk and follow all before steps.

Well I guess, if you fix something on the app itself (and not in the backend) you have to reinstall, but you don’t have to reinstall (provide no app capability). Concerning rerunning failed tests, look into the documentation of the testframework you use. e.g for testng:

do this when you open driver. example with Java:

           if (RESET_NEEDED)
                capabilities.setCapability("fullReset", true);
            else {
                capabilities.setCapability("fullReset", false);
                capabilities.setCapability("noReset", true);