I am trying to run a test file created on eclipse using appium. When I execute the test on a real android device connected to the system, I get the following error:
Enco
The issue speaks for itself: you either did not provide activity to recognise your app or you specified the wrong one.
What you can do:
adb shell dumpsys window windows | grep -E 'mCurrentFocus|mFocusedApp'
com.yourcompany.package/com.yourcompany.package.login.view.LoginActivity
So now you have package - com.yourcompany.package
and activity com.yourcompany.package.login.view.LoginActivity
that you should provide Appium.
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("deviceName", "device");
capabilities.setCapability("app", pathToApk);
capabilities.setCapability("platformName", "android");
capabilities.setCapability("appWaitPackage", "com.yourcompany.package");
capabilities.setCapability("appWaitActivity", "com.yourcompany.package.login.view.LoginActivity");
Works perfectly for me on multiple real devices
I always received "Encountered internal error running command: Error: The application at " "does not exist or is not accessible" I user a Driver wait
and it solved.
Check manually Your app like @dmle said,
adb shell dumpsys window windows | grep -E 'mCurrentFocus|mFocusedApp
The command will provide current package & activity.
Maybe developers changed You package id.
I follow the guide here
Type the following command to Terminal(not execute yet)
adb shell dumpsys window windows | grep -E 'mCurrentFocus|mFocusedApp'
Manually open app on device and execute the above command really quick to find the startActivity.
Copy value of Package and Activity from mFocusedApp=
Check the Activity start-able
adb shell am start -n package.android/.activity.SplashActivity
Set of Capabilities DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("device", "Android");
capabilities.setCapability("platformName", "Android");
capabilities.setCapability("deviceName", "Galaxy Note9");
capabilities.setCapability("appWaitPackage", "package.android");
capabilities.setCapability("appWaitActivity", ".activity.SplashActivity");
capabilities.setCapability("appPackage", "package.android");
capabilities.setCapability("appActivity", ".activity.SplashActivity");
capabilities.setCapability("appWaitDuration", 10000);//this is way optional, 20000 by default
capabilities.setCapability("app", newApp.getAbsolutePath());