Android Launch already installed App

Any one please please help me in launching the already installed app in the device

I will be happy if anyone paste code.

Python Code:
To launch your own app just edit the values in appPackage and appActivity.
This script launches Youtube application in your Android Device.

Type adb devices in your terminal to check if your Android device shows up before performing any of the steps.

Step 1: Save the below code in your local hard drive with filename.py
Step 2: Start Appium server in your System before running this code [Command: Appium &]
Step 3: Open a new terminal > navigate to the file location via terminal and type python filename.py

In the device you can see the Youtube app opening automatically :smile:

import os
import unittest
from appium import webdriver
from time import sleep

class YoutubeAndroidTests(unittest.TestCase):
def setUp(self):
desired_caps = {}
desired_caps[‘platformName’] = ‘Android’
desired_caps[‘platformVersion’] = ‘4.3’
desired_caps[‘deviceName’] = ‘Samsung S3’
desired_caps[‘appPackage’] = ‘com.google.android.youtube’
desired_caps[‘appActivity’] = ‘com.google.android.youtube.HomeActivity’

    self.driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)

def tearDown(self):
    self.driver.quit()

def test_add_listings(self):
    self.driver.implicitly_wait(150)

if name == ‘main’:
suite = unittest.TestLoader().loadTestsFromTestCase(YoutubeAndroidTests)
unittest.TextTestRunner(verbosity=2).run(suite)

By default, your app will be launched by appium, using teh capabilities you pass on to Appium driver [appPackage and appActivity[]

If you are looking at something like below scenario -

  1. As part of the test, you sign out of the app
  2. You want to re-launch the app.

driver,launchApp() ideally should work.

I am using the below code, but the app is not launched

File app = new File(“G://Ravi testing/Apps/Demo.apk”);
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(CapabilityType.BROWSER_NAME, “”);
capabilities.setCapability(“deviceName”,“HT35JW912039”);
//capabilities.setCapability(“deviceName”, “Test”);
capabilities.setCapability(“automationName”,“android-app”);
capabilities.setCapability(“platformName”, “Android”);
capabilities.setCapability(“app”, app.getAbsolutePath());
capabilities.setCapability(“app-package”, “Package name”);
capabilities.setCapability(“app-activity”, “Activity”);
capabilities.setCapability(“takesScreenshot”, true);
//driver= new RemoteWebDriver( new URL(“http://127.0.0.1:4723/wd/hub”), capabilities);
driver= new AndroidDriver( new URL(“http://127.0.0.1:4723/wd/hub”), capabilities) ;

Try the following - Please make sure to put right String value in capabilities [platformVersion, appPackage, appActivity]

    DesiredCapabilities desiredCapabilities = new DesiredCapabilities();
    desiredCapabilities.setCapability("deviceName", "HT35JW912039");
    desiredCapabilities.setCapability("platformName", "android");
    desiredCapabilities.setCapability("platformVersion", "4.4.4");
    desiredCapabilities.setCapability("app", "G://Ravi testing/Apps/Demo.apk");
    desiredCapabilities.setCapability("appPackage", "packageName");
    desiredCapabilities.setCapability("appActivity", "activityName");

    String host = "127.0.0.1";
    String port = "4723";
    
    try {
    	mDriver = new AndroidDriver(
                new URL("http://" + host + ":" + port + "/wd/hub"),
                desiredCapabilities);
    }
    catch(Exception e) {
    	
    }

Tried same code by changing package name and activity name, but no luck Ram…

Can you please paste the Appium error logs from server.

Also, can you share details of Appium server version and client version.

Console Error:

[TestNG] Running:
C:\Users\RAVI\AppData\Local\Temp\testng-eclipse–789315402\testng-customsuite.xml

SignIn started
Verifying Lots in watchlist
Adding Lot to watchlist started
FAILED: Signin
java.lang.NullPointerException
at copart.AddingLotToWatchlist.Signin(AddingLotToWatchlist.java:60)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:85)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:648)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:834)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1142)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:124)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:108)
at org.testng.TestRunner.privateRun(TestRunner.java:771)
at org.testng.TestRunner.run(TestRunner.java:621)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:357)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:352)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:310)
at org.testng.SuiteRunner.run(SuiteRunner.java:259)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1176)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1101)
at org.testng.TestNG.run(TestNG.java:1009)
at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175)

FAILED: VerifyWatchlist
java.lang.NullPointerException
at copart.AddingLotToWatchlist.VerifyWatchlist(AddingLotToWatchlist.java:75)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:85)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:648)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:834)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1142)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:124)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:108)
at org.testng.TestRunner.privateRun(TestRunner.java:771)
at org.testng.TestRunner.run(TestRunner.java:621)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:357)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:352)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:310)
at org.testng.SuiteRunner.run(SuiteRunner.java:259)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1176)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1101)
at org.testng.TestNG.run(TestNG.java:1009)
at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175)

FAILED: Signout
java.lang.NullPointerException
at copart.AddingLotToWatchlist.Signout(AddingLotToWatchlist.java:137)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:85)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:648)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:834)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1142)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:124)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:108)
at org.testng.TestRunner.privateRun(TestRunner.java:771)
at org.testng.TestRunner.run(TestRunner.java:621)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:357)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:352)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:310)
at org.testng.SuiteRunner.run(SuiteRunner.java:259)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1176)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1101)
at org.testng.TestNG.run(TestNG.java:1009)
at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175)

FAILED: Watchlist
java.lang.NullPointerException
at copart.AddingLotToWatchlist.Watchlist(AddingLotToWatchlist.java:90)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:85)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:648)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:834)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1142)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:124)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:108)
at org.testng.TestRunner.privateRun(TestRunner.java:771)
at org.testng.TestRunner.run(TestRunner.java:621)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:357)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:352)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:310)
at org.testng.SuiteRunner.run(SuiteRunner.java:259)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1176)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1101)
at org.testng.TestNG.run(TestNG.java:1009)
at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175)

===============================================
Default test
Tests run: 4, Failures: 4, Skips: 0

These are your test NG logs.
Can you share Appium server logs.

I am just guessing all these null pointer may be due to driver being null [not properly created]

Appium Console

Checking if an update is available
Update not available
Starting Node Server
warn: Appium support for versions of node < 0.12 has been deprecated and will be removed in a future version. Please upgrade!
info: Welcome to Appium v1.4.0 (REV 8f63e2f91ef7907aed8bda763f4e5ca08e86970a)
info: Appium REST http interface listener started on 127.0.0.1:4723
info: [debug] Non-default server args: {“address”:“127.0.0.1”,“logNoColors”:true,“platformName”:“Android”,“platformVersion”:“18”,“automationName”:“Appium”}
info: Console LogLevel: debug
info: --> POST /wd/hub/session {“desiredCapabilities”:{“app”:“E://Android/Apks/copart.apk”,“appPackage”:“com.popcorn.copartapp”,“appActivity”:“activityNamecom.popcorn.copartapp.CopartSplashScreen”,“platformVersion”:“4.4.2”,“platformName”:“Android”,“deviceName”:“42031c94b43da100”}}
info: Client User-Agent string: Apache-HttpClient/4.4.1 (Java/1.8.0_45)
info: [debug] Using local app from desired caps: E:\Android\Apks\copart.apk
info: [debug] Creating new appium session d14e69bc-2368-44d6-b496-121016d73ca0
info: Starting android appium
info: [debug] Getting Java version
info: Java version is: 1.8.0_45
info: [debug] Checking whether adb is present
info: [debug] Using adb from E:\Android\android-sdk-windows\platform-tools\adb.exe
info: [debug] Set chromedriver binary as: C:\Program Files (x86)\Appium\node_modules\appium\build\chromedriver\windows\chromedriver.exe
info: [debug] Using fast reset? true
info: [debug] Preparing device for session
info: [debug] Checking whether app is actually present
info: Retrieving device
info: [debug] Trying to find a connected android device
info: [debug] Getting connected devices…
info: [debug] executing cmd: E:\Android\android-sdk-windows\platform-tools\adb.exe devices
info: [debug] 1 device(s) connected
info: Found device 42031c94b43da100
info: [debug] Setting device id to 42031c94b43da100
info: [debug] Waiting for device to be ready and to respond to shell commands (timeout = 5)
info: [debug] executing cmd: E:\Android\android-sdk-windows\platform-tools\adb.exe -s 42031c94b43da100 wait-for-device
info: [debug] executing cmd: E:\Android\android-sdk-windows\platform-tools\adb.exe -s 42031c94b43da100 shell “echo ‘ready’”
info: [debug] Starting logcat capture
info: [debug] Getting device API level
info: [debug] executing cmd: E:\Android\android-sdk-windows\platform-tools\adb.exe -s 42031c94b43da100 shell “getprop ro.build.version.sdk”
info: [debug] Device is at API Level 19
info: Device API level is: 19
info: [debug] Extracting strings for language: default
info: [debug] executing cmd: E:\Android\android-sdk-windows\platform-tools\adb.exe -s 42031c94b43da100 shell “getprop persist.sys.language”
info: [debug] Current device persist.sys.language: en
info: [debug] java -jar “C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\jars\appium_apk_tools.jar” “stringsFromApk” “E:\Android\Apks\copart.apk” “C:\Users\RAVI\AppData\Local\Temp\com.popcorn.copartapp” en
info: [debug] No strings.xml for language ‘en’, getting default strings.xml
info: [debug] java -jar “C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\jars\appium_apk_tools.jar” “stringsFromApk” “E:\Android\Apks\copart.apk” “C:\Users\RAVI\AppData\Local\Temp\com.popcorn.copartapp”
info: [debug] Reading strings from converted strings.json
info: [debug] Setting language to default
info: [debug] executing cmd: E:\Android\android-sdk-windows\platform-tools\adb.exe -s 42031c94b43da100 push “C:\Users\RAVI\AppData\Local\Temp\com.popcorn.copartapp\strings.json” /data/local/tmp
info: [debug] Checking whether aapt is present
info: [debug] Using aapt from E:\Android\android-sdk-windows\build-tools\22.0.1\aapt.exe
info: [debug] Retrieving process from manifest.
info: [debug] executing cmd: E:\Android\android-sdk-windows\build-tools\22.0.1\aapt.exe dump xmltree E:\Android\Apks\copart.apk AndroidManifest.xml
info: [debug] Set app process to: com.popcorn.copartapp
info: [debug] Not uninstalling app since server not started with --full-reset
info: [debug] Checking app cert for E:\Android\Apks\copart.apk.
info: [debug] executing cmd: java -jar “C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\jars\verify.jar” E:\Android\Apks\copart.apk
info: [debug] App already signed.
info: [debug] Zip-aligning E:\Android\Apks\copart.apk
info: [debug] Checking whether zipalign is present
info: [debug] Using zipalign from E:\Android\android-sdk-windows\build-tools\22.0.1\zipalign.exe
info: [debug] Zip-aligning apk.
info: [debug] executing cmd: E:\Android\android-sdk-windows\build-tools\22.0.1\zipalign.exe -f 4 E:\Android\Apks\copart.apk C:\Users\RAVI\AppData\Local\Temp\11564-2380-79aipq\appium.tmp
info: [debug] MD5 for app is 040386c14a6fe0ab35788193a2a74572
info: [debug] executing cmd: E:\Android\android-sdk-windows\platform-tools\adb.exe -s 42031c94b43da100 shell “ls /data/local/tmp/040386c14a6fe0ab35788193a2a74572.apk”
info: [debug] Getting install status for com.popcorn.copartapp
info: [debug] Getting device API level
info: [debug] executing cmd: E:\Android\android-sdk-windows\platform-tools\adb.exe -s 42031c94b43da100 shell “getprop ro.build.version.sdk”
info: [debug] Device is at API Level 19
info: [debug] executing cmd: E:\Android\android-sdk-windows\platform-tools\adb.exe -s 42031c94b43da100 shell “pm list packages -3 com.popcorn.copartapp”
info: [debug] App is not installed
info: Installing App
info: [debug] executing cmd: E:\Android\android-sdk-windows\platform-tools\adb.exe -s 42031c94b43da100 shell “mkdir -p /data/local/tmp/”
info: [debug] Removing any old apks
info: [debug] executing cmd: E:\Android\android-sdk-windows\platform-tools\adb.exe -s 42031c94b43da100 shell “ls /data/local/tmp/*.apk”
info: [debug] Found an apk we want to keep at /data/local/tmp/040386c14a6fe0ab35788193a2a74572.apk
info: [debug] Couldn’t find any apks to remove
info: [debug] Uninstalling com.popcorn.copartapp
info: [debug] executing cmd: E:\Android\android-sdk-windows\platform-tools\adb.exe -s 42031c94b43da100 shell “am force-stop com.popcorn.copartapp”
info: [debug] executing cmd: E:\Android\android-sdk-windows\platform-tools\adb.exe -s 42031c94b43da100 uninstall com.popcorn.copartapp
info: [debug] App was not uninstalled, maybe it wasn’t on device?
info: [debug] executing cmd: E:\Android\android-sdk-windows\platform-tools\adb.exe -s 42031c94b43da100 shell “pm install -r /data/local/tmp/040386c14a6fe0ab35788193a2a74572.apk”
info: [debug] Forwarding system:4724 to device:4724
info: [debug] executing cmd: E:\Android\android-sdk-windows\platform-tools\adb.exe -s 42031c94b43da100 forward tcp:4724 tcp:4724
info: [debug] Pushing appium bootstrap to device…
info: [debug] executing cmd: E:\Android\android-sdk-windows\platform-tools\adb.exe -s 42031c94b43da100 push “C:\Program Files (x86)\Appium\node_modules\appium\build\android_bootstrap\AppiumBootstrap.jar” /data/local/tmp/
info: [debug] Pushing settings apk to device…
info: [debug] executing cmd: E:\Android\android-sdk-windows\platform-tools\adb.exe -s 42031c94b43da100 install “C:\Program Files (x86)\Appium\node_modules\appium\build\settings_apk\settings_apk-debug.apk”

Your appium server log seem to be incomplete, as it does not point out at actual error.

Looking at above part in log, your “appActivity” value looks be incorrect. I believe, it should be com.popcorn.copartapp.CopartSplashScreen , but has additional text activityName at the beginning.

Can you paste remaining server logs and also code snippet where you create DesiredCapabilities object.

Capabilities COde

DesiredCapabilities desiredCapabilities = new DesiredCapabilities();
// desiredCapabilities.setCapability(“deviceName”, “HT35JW912039”);
desiredCapabilities.setCapability(“deviceName”,“42031c94b43da100”); // HTC
desiredCapabilities.setCapability(“platformName”, “android”);
desiredCapabilities.setCapability(“platformVersion”, “4.4.2”);
desiredCapabilities.setCapability(“app”, “E://Android/Apks/copart.apk”);
desiredCapabilities.setCapability(“appPackage”, “com.popcorn.copartapp”);
desiredCapabilities.setCapability(“appActivity”, “com.popcorn.copartapp.CopartSplashScreen”);

String host = "127.0.0.1";
String port = "4723";

try {
	mDriver = new AndroidDriver(
            new URL("http://" + host + ":" + port + "/wd/hub"),
            desiredCapabilities);
}
catch(Exception e) {
	
}
System.out.println("App launched");

Appium Log

Starting Node Server
warn: Appium support for versions of node < 0.12 has been deprecated and will be removed in a future version. Please upgrade!
info: Welcome to Appium v1.4.0 (REV 8f63e2f91ef7907aed8bda763f4e5ca08e86970a)
info: Appium REST http interface listener started on 127.0.0.1:4723
info: [debug] Non-default server args: {“address”:“127.0.0.1”,“logNoColors”:true,“platformName”:“Android”,“platformVersion”:“18”,“automationName”:“Appium”}
info: Console LogLevel: debug
info: --> POST /wd/hub/session {“desiredCapabilities”:{“app”:“E://Android/Apks/copart.apk”,“appPackage”:“com.popcorn.copartapp”,“appActivity”:“com.popcorn.copartapp.CopartSplashScreen”,“platformVersion”:“4.4.2”,“platformName”:“Android”,“deviceName”:“42031c94b43da100”}}
info: Client User-Agent string: Apache-HttpClient/4.4.1 (Java/1.8.0_45)
info: [debug] Using local app from desired caps: E:\Android\Apks\copart.apk
info: [debug] Creating new appium session 37dfaa74-4680-4d08-ab38-e9a0bb06e630
info: Starting android appium
info: [debug] Getting Java version
info: Java version is: 1.8.0_45
info: [debug] Checking whether adb is present
info: [debug] Using adb from E:\Android\android-sdk-windows\platform-tools\adb.exe
info: [debug] Set chromedriver binary as: C:\Program Files (x86)\Appium\node_modules\appium\build\chromedriver\windows\chromedriver.exe
info: [debug] Using fast reset? true
info: [debug] Preparing device for session
info: [debug] Checking whether app is actually present
info: Retrieving device
info: [debug] Trying to find a connected android device
info: [debug] Getting connected devices…
info: [debug] executing cmd: E:\Android\android-sdk-windows\platform-tools\adb.exe devices
info: [debug] 1 device(s) connected
info: Found device 42031c94b43da100
info: [debug] Setting device id to 42031c94b43da100
info: [debug] Waiting for device to be ready and to respond to shell commands (timeout = 5)
info: [debug] executing cmd: E:\Android\android-sdk-windows\platform-tools\adb.exe -s 42031c94b43da100 wait-for-device
info: [debug] executing cmd: E:\Android\android-sdk-windows\platform-tools\adb.exe -s 42031c94b43da100 shell “echo ‘ready’”
info: [debug] Starting logcat capture
info: [debug] Getting device API level
info: [debug] executing cmd: E:\Android\android-sdk-windows\platform-tools\adb.exe -s 42031c94b43da100 shell “getprop ro.build.version.sdk”
info: [debug] Device is at API Level 19
info: Device API level is: 19
info: [debug] Extracting strings for language: default
info: [debug] executing cmd: E:\Android\android-sdk-windows\platform-tools\adb.exe -s 42031c94b43da100 shell “getprop persist.sys.language”
info: [debug] Current device persist.sys.language: en
info: [debug] java -jar “C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\jars\appium_apk_tools.jar” “stringsFromApk” “E:\Android\Apks\copart.apk” “C:\Users\RAVI\AppData\Local\Temp\com.popcorn.copartapp” en
info: [debug] No strings.xml for language ‘en’, getting default strings.xml
info: [debug] java -jar “C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\jars\appium_apk_tools.jar” “stringsFromApk” “E:\Android\Apks\copart.apk” “C:\Users\RAVI\AppData\Local\Temp\com.popcorn.copartapp”
info: [debug] Reading strings from converted strings.json
info: [debug] Setting language to default
info: [debug] executing cmd: E:\Android\android-sdk-windows\platform-tools\adb.exe -s 42031c94b43da100 push “C:\Users\RAVI\AppData\Local\Temp\com.popcorn.copartapp\strings.json” /data/local/tmp
info: [debug] Checking whether aapt is present
info: [debug] Using aapt from E:\Android\android-sdk-windows\build-tools\22.0.1\aapt.exe
info: [debug] Retrieving process from manifest.
info: [debug] executing cmd: E:\Android\android-sdk-windows\build-tools\22.0.1\aapt.exe dump xmltree E:\Android\Apks\copart.apk AndroidManifest.xml
info: [debug] Set app process to: com.popcorn.copartapp
info: [debug] Not uninstalling app since server not started with --full-reset
info: [debug] Checking app cert for E:\Android\Apks\copart.apk.
info: [debug] executing cmd: java -jar “C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\jars\verify.jar” E:\Android\Apks\copart.apk
info: [debug] App already signed.
info: [debug] Zip-aligning E:\Android\Apks\copart.apk
info: [debug] Checking whether zipalign is present
info: [debug] Using zipalign from E:\Android\android-sdk-windows\build-tools\22.0.1\zipalign.exe
info: [debug] Zip-aligning apk.
info: [debug] executing cmd: E:\Android\android-sdk-windows\build-tools\22.0.1\zipalign.exe -f 4 E:\Android\Apks\copart.apk C:\Users\RAVI\AppData\Local\Temp\11565-2508-1j6amgm\appium.tmp
info: [debug] MD5 for app is 040386c14a6fe0ab35788193a2a74572
info: [debug] executing cmd: E:\Android\android-sdk-windows\platform-tools\adb.exe -s 42031c94b43da100 shell “ls /data/local/tmp/040386c14a6fe0ab35788193a2a74572.apk”
info: [debug] Getting install status for com.popcorn.copartapp
info: [debug] Getting device API level
info: [debug] executing cmd: E:\Android\android-sdk-windows\platform-tools\adb.exe -s 42031c94b43da100 shell “getprop ro.build.version.sdk”
info: [debug] Device is at API Level 19
info: [debug] executing cmd: E:\Android\android-sdk-windows\platform-tools\adb.exe -s 42031c94b43da100 shell “pm list packages -3 com.popcorn.copartapp”
info: [debug] App is not installed
info: Installing App
info: [debug] executing cmd: E:\Android\android-sdk-windows\platform-tools\adb.exe -s 42031c94b43da100 shell “mkdir -p /data/local/tmp/”
info: [debug] Removing any old apks
info: [debug] executing cmd: E:\Android\android-sdk-windows\platform-tools\adb.exe -s 42031c94b43da100 shell “ls /data/local/tmp/*.apk”
info: [debug] Found an apk we want to keep at /data/local/tmp/040386c14a6fe0ab35788193a2a74572.apk
info: [debug] Couldn’t find any apks to remove
info: [debug] Uninstalling com.popcorn.copartapp
info: [debug] executing cmd: E:\Android\android-sdk-windows\platform-tools\adb.exe -s 42031c94b43da100 shell “am force-stop com.popcorn.copartapp”
info: [debug] executing cmd: E:\Android\android-sdk-windows\platform-tools\adb.exe -s 42031c94b43da100 uninstall com.popcorn.copartapp
info: [debug] App was not uninstalled, maybe it wasn’t on device?
info: [debug] executing cmd: E:\Android\android-sdk-windows\platform-tools\adb.exe -s 42031c94b43da100 shell “pm install -r /data/local/tmp/040386c14a6fe0ab35788193a2a74572.apk”
info: [debug] Forwarding system:4724 to device:4724
info: [debug] executing cmd: E:\Android\android-sdk-windows\platform-tools\adb.exe -s 42031c94b43da100 forward tcp:4724 tcp:4724
info: [debug] Pushing appium bootstrap to device…
info: [debug] executing cmd: E:\Android\android-sdk-windows\platform-tools\adb.exe -s 42031c94b43da100 push “C:\Program Files (x86)\Appium\node_modules\appium\build\android_bootstrap\AppiumBootstrap.jar” /data/local/tmp/
info: [debug] Pushing settings apk to device…
info: [debug] executing cmd: E:\Android\android-sdk-windows\platform-tools\adb.exe -s 42031c94b43da100 install “C:\Program Files (x86)\Appium\node_modules\appium\build\settings_apk\settings_apk-debug.apk”
info: [debug] Pushing unlock helper app to device…
info: [debug] executing cmd: E:\Android\android-sdk-windows\platform-tools\adb.exe -s 42031c94b43da100 install “C:\Program Files (x86)\Appium\node_modules\appium\build\unlock_apk\unlock_apk-debug.apk”
info: Starting App
info: [debug] Attempting to kill all ‘uiautomator’ processes
info: [debug] Getting all processes with ‘uiautomator’
info: [debug] executing cmd: E:\Android\android-sdk-windows\platform-tools\adb.exe -s 42031c94b43da100 shell “ps ‘uiautomator’”
info: [debug] No matching processes found
info: [debug] Running bootstrap
info: [debug] spawning: E:\Android\android-sdk-windows\platform-tools\adb.exe -s 42031c94b43da100 shell uiautomator runtest AppiumBootstrap.jar -c io.appium.android.bootstrap.Bootstrap -e pkg com.popcorn.copartapp -e disableAndroidWatchers false
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: numtests=1
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=
info: [debug] [UIAUTOMATOR STDOUT] io.appium.android.bootstrap.Bootstrap:
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: id=UiAutomatorTestRunner
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: test=testRunServer
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: class=io.appium.android.bootstrap.Bootstrap
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: current=1
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: 1
info: [debug] [BOOTSTRAP] [debug] Socket opened on port 4724
info: [debug] [BOOTSTRAP] [debug] Appium Socket Server Ready
info: [debug] [BOOTSTRAP] [debug] Loading json…
info: [debug] Waking up device if it’s not alive
info: [debug] Pushing command to appium work queue: [“wake”,{}]
info: [debug] [BOOTSTRAP] [debug] json loading complete.
info: [debug] [BOOTSTRAP] [debug] Registered crash watchers.
info: [debug] [BOOTSTRAP] [debug] Client connected
info: [debug] [BOOTSTRAP] [debug] Got data from client: {“cmd”:“action”,“action”:“wake”,“params”:{}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: wake
info: [debug] [BOOTSTRAP] [debug] Returning result: {“value”:true,“status”:0}
info: [debug] executing cmd: E:\Android\android-sdk-windows\platform-tools\adb.exe -s 42031c94b43da100 shell “dumpsys window”
info: [debug] Screen already unlocked, continuing.
info: [debug] Pushing command to appium work queue: [“getDataDir”,{}]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {“cmd”:“action”,“action”:“getDataDir”,“params”:{}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: getDataDir
info: [debug] [BOOTSTRAP] [debug] Returning result: {“value”:"/data/local/tmp",“status”:0}
info: [debug] dataDir set to: /data/local/tmp
info: [debug] Pushing command to appium work queue: [“compressedLayoutHierarchy”,{“compressLayout”:false}]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {“cmd”:“action”,“action”:“compressedLayoutHierarchy”,“params”:{“compressLayout”:false}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: compressedLayoutHierarchy
info: [debug] [BOOTSTRAP] [debug] Returning result: {“value”:false,“status”:0}
info: [debug] Getting device API level
info: [debug] executing cmd: E:\Android\android-sdk-windows\platform-tools\adb.exe -s 42031c94b43da100 shell “getprop ro.build.version.sdk”
info: [debug] Device is at API Level 19
info: [debug] executing cmd: E:\Android\android-sdk-windows\platform-tools\adb.exe -s 42031c94b43da100 shell “am start -S -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -f 0x10200000 -n com.popcorn.copartapp/com.popcorn.copartapp.CopartSplashScreen”
info: [debug] We tried to start an activity that doesn’t exist, retrying with . prepended to activity
info: [debug] Getting device API level
info: [debug] executing cmd: E:\Android\android-sdk-windows\platform-tools\adb.exe -s 42031c94b43da100 shell “getprop ro.build.version.sdk”
info: [debug] Device is at API Level 19
info: [debug] executing cmd: E:\Android\android-sdk-windows\platform-tools\adb.exe -s 42031c94b43da100 shell “am start -S -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -f 0x10200000 -n com.popcorn.copartapp/.com.popcorn.copartapp.CopartSplashScreen”
error: Activity used to start app doesn’t exist or cannot be launched! Make sure it exists and is a launchable activity
info: [debug] Stopping logcat capture
info: [debug] Logcat terminated with code null, signal SIGTERM
info: [debug] [BOOTSTRAP] [debug] Got data from client: {“cmd”:“shutdown”}
info: [debug] [BOOTSTRAP] [debug] Got command of type SHUTDOWN
info: [debug] [BOOTSTRAP] [debug] Returning result: {“value”:“OK, shutting down”,“status”:0}
info: [debug] [BOOTSTRAP] [debug] Closed client connection
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: numtests=1
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=.
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: id=UiAutomatorTestRunner
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: test=testRunServer
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: class=io.appium.android.bootstrap.Bootstrap
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: current=1
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: 0
info: [debug] Sent shutdown command, waiting for UiAutomator to stop…
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=
info: [debug] [UIAUTOMATOR STDOUT] Test results for WatcherResultPrinter=.
info: [debug] [UIAUTOMATOR STDOUT] Time: 4.366
info: [debug] [UIAUTOMATOR STDOUT] OK (1 test)
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: -1
info: [debug] UiAutomator shut down normally
error: Failed to start an Appium session, err was: Error: Activity used to start app doesn’t exist or cannot be launched! Make sure it exists and is a launchable activity
info: [debug] Cleaning up android objects
info: [debug] Cleaning up appium session
info: [debug] Error: Activity used to start app doesn’t exist or cannot be launched! Make sure it exists and is a launchable activity
at [object Object]. (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\lib\adb.js:1146:21)
at [object Object]. (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\lib\adb.js:180:9)
at ChildProcess.exithandler (child_process.js:635:7)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:743:16)
at Process.ChildProcess._handle.onexit (child_process.js:810:5)
info: [debug] Responding to client with error: {“status”:33,“value”:{“message”:“A new session could not be created. (Original error: Activity used to start app doesn’t exist or cannot be launched! Make sure it exists and is a launchable activity)”,“origValue”:“Activity used to start app doesn’t exist or cannot be launched! Make sure it exists and is a launchable activity”},“sessionId”:null}
info: <-- POST /wd/hub/session 500 77406.440 ms - 346

The activity name you passed as a start activity is not correct.

The problem you are facing is related to ADB not able to find Activity which we are passing in command line.
If you are not able to launch app using simple ADB command from command line, it means your activity package name is not correct.It is even not related to appium. Its plain adb command.

I would suggest you to install app manually on to device using command -

 adb install {application path}

Then install apk info from playstore. Open APK info application and get details of the package name of application. and Package name of Dashboard activity.

Then run this command from command line -

 adb shell am start -n {application package name}/{Launcher activity package name}.activityName

ex : adb shell am start -n com.popcorn.copartapp/com.x.y.activitypackagename.activityName

Similar discussion is ongoing at thread - Getting Error info: [debug] Error: Activity used to start app doesn't exist or cannot be launched! Make sure it exists and is a launchable activity

1 Like

Thanks Ram. It worked.

Hi Ram & Ravi

I am getting same problem and unable to launch android application.
I have tried all the methods and get nothing on any blog or anywhere.
Please see my logs and code and help me out… i am totally stucked and very new to Appium

Appium Logs:

info: --> POST /wd/hub/session {“desiredCapabilities”:{“app”:“D:\Appium\Whatsapp\WhatsApp.apk”,“appPackage”:“com.whatsapp”,“appActivity”:“com.whatsapp.Main”,“platformVersion”:“6.0”,“browserName”:"",“platformName”:“Android”,“deviceName”:“Mi498HA14090346”}}
info: Client User-Agent string: Apache-HttpClient/4.5.1 (Java/1.8.0_66)
info: [debug] Using local app from desired caps: D:\Appium\Whatsapp\WhatsApp.apk
info: [debug] Creating new appium session 9bf0c62d-b4ac-454a-938b-dfc46b4e9afc
info: Starting android appium
info: [debug] Getting Java version
info: Java version is: 1.8.0_66
info: [debug] Checking whether adb is present
info: [debug] Using adb from D:\Cherrey\sdk\platform-tools\adb.exe
info: [debug] Using fast reset? true
info: [debug] Preparing device for session
info: [debug] Checking whether app is actually present
info: Retrieving device
info: [debug] Trying to find a connected android device
info: [debug] Getting connected devices…
info: [debug] executing cmd: D:\Cherrey\sdk\platform-tools\adb.exe devices
info: [debug] 1 device(s) connected
info: Found device sp7731c21005c070464
info: [debug] Setting device id to sp7731c21005c070464
info: [debug] Waiting for device to be ready and to respond to shell commands (timeout = 5)
info: [debug] executing cmd: D:\Cherrey\sdk\platform-tools\adb.exe -s sp7731c21005c070464 wait-for-device
info: [debug] executing cmd: D:\Cherrey\sdk\platform-tools\adb.exe -s sp7731c21005c070464 shell “echo ‘ready’”
info: [debug] Starting logcat capture
info: [debug] Getting device API level
info: [debug] executing cmd: D:\Cherrey\sdk\platform-tools\adb.exe -s sp7731c21005c070464 shell “getprop ro.build.version.sdk”
info: [debug] Device is at API Level 23
info: Device API level is: 23
info: [debug] Extracting strings for language: default
info: [debug] executing cmd: D:\Cherrey\sdk\platform-tools\adb.exe -s sp7731c21005c070464 shell “getprop persist.sys.language”
info: [debug] Current device persist.sys.language:
info: [debug] java -jar “C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\jars\appium_apk_tools.jar” “stringsFromApk” “D:\Appium\Whatsapp\WhatsApp.apk” “C:\Users\RISHAB~1.JAI\AppData\Local\Temp\com.whatsapp”
info: [debug] Reading strings from converted strings.json
info: [debug] Setting language to default
info: [debug] executing cmd: D:\Cherrey\sdk\platform-tools\adb.exe -s sp7731c21005c070464 push “C:\Users\RISHAB~1.JAI\AppData\Local\Temp\com.whatsapp\strings.json” /data/local/tmp
info: [debug] Checking whether aapt is present
info: [debug] Using aapt from D:\Cherrey\sdk\build-tools\android-4.4W\aapt.exe
info: [debug] Retrieving process from manifest.
info: [debug] executing cmd: D:\Cherrey\sdk\build-tools\android-4.4W\aapt.exe dump xmltree D:\Appium\Whatsapp\WhatsApp.apk AndroidManifest.xml
info: [debug] Set app process to: com.whatsapp
info: [debug] Not uninstalling app since server not started with --full-reset
info: [debug] Checking app cert for D:\Appium\Whatsapp\WhatsApp.apk.
info: [debug] executing cmd: java -jar “C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\jars\verify.jar” D:\Appium\Whatsapp\WhatsApp.apk
info: [debug] App already signed.
info: [debug] Zip-aligning D:\Appium\Whatsapp\WhatsApp.apk
info: [debug] Checking whether zipalign is present
info: [debug] Using zipalign from D:\Cherrey\sdk\build-tools\android-4.4W\zipalign.exe
info: [debug] Zip-aligning apk.
info: [debug] executing cmd: D:\Cherrey\sdk\build-tools\android-4.4W\zipalign.exe -f 4 D:\Appium\Whatsapp\WhatsApp.apk C:\Users\RISHAB~1.JAI\AppData\Local\Temp\116112-15112-nqoy3v\appium.tmp
info: [debug] MD5 for app is 4fb3cc813bcf5837bf8e009648edebd9
info: [debug] executing cmd: D:\Cherrey\sdk\platform-tools\adb.exe -s sp7731c21005c070464 shell “ls /data/local/tmp/4fb3cc813bcf5837bf8e009648edebd9.apk”
info: [debug] Getting install status for com.whatsapp
info: [debug] Getting device API level
info: [debug] executing cmd: D:\Cherrey\sdk\platform-tools\adb.exe -s sp7731c21005c070464 shell “getprop ro.build.version.sdk”
info: [debug] Device is at API Level 23
info: [debug] executing cmd: D:\Cherrey\sdk\platform-tools\adb.exe -s sp7731c21005c070464 shell “pm list packages -3 com.whatsapp”
info: [debug] App is installed
info: App is already installed, resetting app
info: [debug] Running fast reset (stop and clear)
info: [debug] executing cmd: D:\Cherrey\sdk\platform-tools\adb.exe -s sp7731c21005c070464 shell “am force-stop com.whatsapp”
info: [debug] executing cmd: D:\Cherrey\sdk\platform-tools\adb.exe -s sp7731c21005c070464 shell “pm clear com.whatsapp”
info: [debug] Forwarding system:4724 to device:4724
info: [debug] executing cmd: D:\Cherrey\sdk\platform-tools\adb.exe -s sp7731c21005c070464 forward tcp:4724 tcp:4724
info: [debug] Pushing appium bootstrap to device…
info: [debug] executing cmd: D:\Cherrey\sdk\platform-tools\adb.exe -s sp7731c21005c070464 push “C:\Program Files (x86)\Appium\node_modules\appium\build\android_bootstrap\AppiumBootstrap.jar” /data/local/tmp/
info: [debug] Pushing settings apk to device…
info: [debug] executing cmd: D:\Cherrey\sdk\platform-tools\adb.exe -s sp7731c21005c070464 install “C:\Program Files (x86)\Appium\node_modules\appium\build\settings_apk\settings_apk-debug.apk”
info: [debug] Stopping logcat capture
info: [debug] Logcat terminated with code null, signal SIGTERM
info: [debug] Sent shutdown command, waiting for UiAutomator to stop…
warn: UiAutomator did not shut down fast enough, calling it gone
info: [debug] Cleaning up android objects
info: [debug] Cleaning up appium session
error: Failed to start an Appium session, err was: Error: Command failed: C:\Windows\system32\cmd.exe /s /c “D:\Cherrey\sdk\platform-tools\adb.exe -s sp7731c21005c070464 install “C:\Program Files (x86)\Appium\node_modules\appium\build\settings_apk\settings_apk-debug.apk””

info: [debug] Error: Command failed: C:\Windows\system32\cmd.exe /s /c “D:\Cherrey\sdk\platform-tools\adb.exe -s sp7731c21005c070464 install “C:\Program Files (x86)\Appium\node_modules\appium\build\settings_apk\settings_apk-debug.apk””

at ChildProcess.exithandler (child_process.js:751:12)
at ChildProcess.emit (events.js:110:17)
at maybeClose (child_process.js:1016:16)
at Process.ChildProcess._handle.onexit (child_process.js:1088:5)

info: [debug] Responding to client with error: {“status”:33,“value”:{“message”:“A new session could not be created. (Original error: Command failed: C:\Windows\system32\cmd.exe /s /c “D:\Cherrey\sdk\platform-tools\adb.exe -s sp7731c21005c070464 install “C:\Program Files (x86)\Appium\node_modules\appium\build\settings_apk\settings_apk-debug.apk””\n)”,“killed”:false,“code”:3221226356,“signal”:null,“cmd”:“C:\Windows\system32\cmd.exe /s /c “D:\Cherrey\sdk\platform-tools\adb.exe -s sp7731c21005c070464 install “C:\Program Files (x86)\Appium\node_modules\appium\build\settings_apk\settings_apk-debug.apk”””,“origValue”:“Command failed: C:\Windows\system32\cmd.exe /s /c “D:\Cherrey\sdk\platform-tools\adb.exe -s sp7731c21005c070464 install “C:\Program Files (x86)\Appium\node_modules\appium\build\settings_apk\settings_apk-debug.apk””\n”},“sessionId”:null}
info: <-- POST /wd/hub/session 500 24140.098 ms - 862

Code:
private static AndroidDriver driver = null;

public static void main(String g[]) throws MalformedURLException,InterruptedException
{
	File app = new File("D://Appium//Whatsapp//WhatsApp.apk");
	DesiredCapabilities cap = new DesiredCapabilities();
	cap.setCapability(CapabilityType.BROWSER_NAME, "");
	cap.setCapability("deviceName", "Mi498HA14090346");
	cap.setCapability("platformName", "Android");
	//cap.setCapability("automationName", "android-app");
	cap.setCapability("platformVersion", "6.0");	
	cap.setCapability("app", app.getAbsolutePath());
	cap.setCapability("appPackage", "com.whatsapp");
	cap.setCapability("appActivity", "com.whatsapp.Main");
	
	//driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"),cap);

	String host = "127.0.0.1";
    String port = "4723";
    
    try {
    	driver = new AndroidDriver(
                new URL("http://" + host + ":" + port + "/wd/hub"),
                cap);
    }
    catch(Exception e) {
    	
    }
    System.out.println("APP Launched");
	driver.manage().timeouts().implicitlyWait(80, TimeUnit.SECONDS);
	Thread.sleep(10000);
	driver.quit();

I had a similar issue. I just wanted to open an existing app in my phone and i think I finally sorted out by adding the parameters in the capabilities setting in my java code. See below:

File appDir = new File("apk");
File app = new File(appDir, "ums.apk");

DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("device", "Android");

// mandatory capabilities
capabilities.setCapability("deviceName", "Nexus5Android5");
capabilities.setCapability("platformName", "Android");

// other caps
//capabilities.setCapability("app", app.getAbsolutePath());
// capabilities.setCapability("app", appUrl);

**//Open the app without installing it**
capabilities.setCapability("appPackage", "nz.co.airnz.mobile.unaccompaniedminors");
capabilities.setCapability("appActivity", "activity.StartUpActivity");

My problem now is that because im using a real device, the app could have a user logged in or not when i run the test. If there is an existing user logged into the app, my test fails because the first test i run is a login test and obviously it won’t find the elements in the screen.

Is there any parameter I can use to force any to logout automatically?

I have tried the ‘Override existing session’ parameter in Appium but this doesn’t work because it’s related to the server session, not the app session.

Any help would be appreciated.

Thanks.

Is that possible to launch app using ADB SHELL using Appium? If I use appPackage & appActivity to pass values its launching but after that got crashed, so Just thinking to use Shell command instead of these launching Capabilities.

Please someone help me on this.

Can you add these capabilities and try

	capabilities.setCapability("noReset",true);
	capabilities.setCapability("fullReset",false);