Upgrade Android App from Old version to New Version using Appium

I have an Android Application with 2.3 version. Now i need to upgrade this app from 2.3 to 2.4 version. How can I do this?
I use the below code for fresh installation. Can anybody help me out ?
public void freshInstall() throws MalformedURLException, InterruptedException
File app = new File(“D:\Selenium_Related_Files\android_2_3_EclipseBuild.apk”);
DesiredCapabilities capa = new DesiredCapabilities();
capa.setCapability(“device”, “Android”);
capa.setCapability(“platformVersion”, “5.0.2”);
capa.setCapability(“deviceName”, “SM-T805”);
capa.setCapability(“platformName”, “Android”);
capa.setCapability(“app”, app.getAbsolutePath());

    driver = new AndroidDriver(new URL(""),capa);
    driver.manage().timeouts().implicitlyWait(20L, TimeUnit.SECONDS);


You can try

If above method says that app with same package is already installed then you can use
adb uninstall [app Package Name]

There is a way you can programmatically run above adb command using JAVA program on cmd and then work with driver.install or launch app with new apk file path it will directly gets installed first …