Appium Android App Launching


I dont want to reset app again and again,

i am using “fullreset”-fals,norest-true ,but these are not working.

Are you restarting the appium server or driver? You should try setting autoLaunch to false. This prevents it from being (re)installed and started. You’ll have to install and start it yourself.

Have you defined ‘app’ in your capabilities? This will always perform application installation

capabilities.setCapability(MobileCapabilityType.APP, "/Users/admin/Desktop/IntegrationApp.apk");


// appium: 1.6.5-beta, java-client: 5.0.0-BETA6

                 capabilities.setCapability(MobileCapabilityType.APP, appDir.getAbsolutePath());
                 capabilities.setCapability("appWaitActivity", "xx.xxxx.*");

                if (devicePlatform.contains("fullReset")) { // reinstall client
                    System.out.println("  Driver DO FULL-RESET");
                    capabilities.setCapability(MobileCapabilityType.FULL_RESET, true);
                    capabilities.setCapability(MobileCapabilityType.NO_RESET, false);
                    capabilities.setCapability("autoGrantPermissions", "true");
                } else if (devicePlatform.contains("fastReset")) { // clears cache without reinstall
                    System.out.println("  Driver DO FAST-RESET");
                    capabilities.setCapability(MobileCapabilityType.FULL_RESET, false);
                    capabilities.setCapability(MobileCapabilityType.NO_RESET, false);
                    capabilities.setCapability("autoGrantPermissions", "true");
                } else {
                    System.out.println("  Driver DO NORMAL start");
                    capabilities.setCapability(MobileCapabilityType.FULL_RESET, false);
                    capabilities.setCapability(MobileCapabilityType.NO_RESET, true);

capabilities.setCapability(MobileCapabilityType.APP, appDir.getAbsolutePath());

Replace above capability with ‘appPackage’ ( and ‘appActivity’ ( and make sure application is pre installed. Hope this should resolve your problem.

@danandpara below does not reset app in any way. although your proposal will also work.

capabilities.setCapability(MobileCapabilityType.APP, appDir.getAbsolutePath());

@Aleksei Yes we know that it will not reset the app but it will re install application whenever capabilities are called.

@danandpara you are wrong. look into Appium adb logs what happens. can you say what command does reinstall?

example of logs (Normal start in mine example) where we see that Appium is checking that app is installed:

2017-04-27 10:06:48:700 - [debug] [ADB] Running '/Users/Aleksei/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","LGH8155e9892e6","shell","ls","/data/local/tmp/c2befbb807e24541eb3b9e16b604bd37.apk"]
2017-04-27 10:06:48:761 - [debug] [AndroidDriver] Checking if app is installed
2017-04-27 10:06:48:761 - [debug] [ADB] Getting install status for xx.xxxx.xxxx
2017-04-27 10:06:48:761 - [debug] [ADB] Getting connected devices...
2017-04-27 10:06:48:776 - [debug] [ADB] 1 device(s) connected
2017-04-27 10:06:48:777 - [debug] [ADB] Running '/Users/Aleksei/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","LGH8155e9892e6","shell","pm","list","packages","xx.xxxx.xxxx"]
2017-04-27 10:06:49:441 - [debug] [ADB] App is installed

then is it starting app with:

2017-04-27 10:06:52:423 - [debug] [ADB] Running '/Users/Aleksei/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","LGH8155e9892e6","shell","am","start","-W","-n","xx.xxxx.xxxx/xx.xxxx.activityXxxxxScreenActivity","-S","-a","android.intent.action.MAIN","-c","android.intent.category.LAUNCHER","-f","0x10200000"]
2017-04-27 10:06:54:309 - [debug] [ADB] Waiting for pkg: 'xx.xxxx.xxxx' and activity: 'xx.xxxx.*' to be focused
2017-04-27 10:06:54:310 - [debug] [ADB] Possible activities, to be checked: xx.xxxx.*, xx.xxxx.xxxx.xx.xxxx.*
2017-04-27 10:06:54:311 - [debug] [ADB] Getting focused package and activity

@Aleksei Agree that appium will not reinstall application if already installed.
But it will reset the application

[debug] [ADB] Getting install status for
[debug] [ADB] Getting connected devices…
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running C:\Android-SDK\android-sdk-windows\sdk\platform-tools\adb.exe with args: [“-P”,5037,“-s”,“1215fc4d89b70805”,“shell”,“getprop”,“”]
[debug] [ADB] Device API level: 23
[debug] [ADB] Getting connected devices…
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running C:\Android-SDK\android-sdk-windows\sdk\platform-tools\adb.exe with args: [“-P”,5037,“-s”,“1215fc4d89b70805”,“shell”,“pm”,“list”,“packages”,“-3”,"
[debug] [ADB] App is installed
[AndroidDriver] Apk is already on remote and installed, resetting
[debug] [AndroidDriver] Running fast reset (stop and clear)


@danandpara it happens when we do:

capabilities.setCapability(MobileCapabilityType.NO_RESET, false);

FAST-RESET in mine example. what your capabilities where? just wonder why it does not happen with me.

From doc: “noReset Don’t reset app state before this session. Default false” So when you does not mention it it does reset.

In our case we did not mentioned ‘noReset’ flag.

There were few doubts on my end which got resolved.
Thanks @Aleksei :slight_smile:

@danandpara so set to “true” and give a try :slight_smile: