Reputation: 1130
When I try using Appium to test my Hello World Android app, I get Activity used to start app doesn't exist! Make sure it exists
com.company.myapp
MainActivity
adt-bundle-mac-x86_64-20131030/sdk/tools/emulator -avd 4.4-KitKat-Nexus-4
app-activity
:
"MainActivity"
".MainActivity"
"com.company.myapp.MainActivity"
debug: Request received with params: {"desiredCapabilities":{"newCommandTimeout":"60","app":"/Users/me/Development/workspace/myapp/bin/myapp.apk","platform":"MAC","browserName":"","app-package":"com.company.myapp","device-ready-timeout":"60","device":"android","launch":"true","compressXml":"true","app-wait-activity":"com.company.myapp.MainActivity","app-activity":"com.company.myapp.MainActivity","version":"4.4"}}
adb -s emulator-5554 shell pm install -r [apk it found that it wants to keep]
, forwards port 4724
, wakes up device getting {"value":true,"status":0}
, ensures screen is unlocked ...And then it executes adb -s emulator-5554 shell am start -n com.company.myapp/com.company.myapp.MainActivity
and gives the error message above.
It also tries with . prepended to activity and gives the same error message.
Upvotes: 2
Views: 6722
Reputation: 402
Check package name in .java or .kt in the respective app is same as in XML package name.
for example : XML - tools:context="com.example.emptyname.MainActivity" kt - package com.example.emptyname
Upvotes: 1
Reputation: 921
Does not clear the app data and launch the app from the desire activity
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("deviceName","Galaxy E7");
capabilities.setCapability("platformName", "Android");
capabilities.setCapability("version", "5.1.1");
capabilities.setCapability("noReset", true);
capabilities.setCapability("fullReset", false);
capabilities.setCapability("app", "D:/Builds/RSQuare_Live.apk");
capabilities.setCapability("app-wait-activity", "com.rr.consultants.base.SpalshScreenActivity");
Upvotes: 0
Reputation: 1130
I discovered that if the app was installed prior to running my test, it didn't complain about the Activity being absent.
And if I launch appium with appium --full-reset
it uninstalls the existing app and then installs some apk and finds the Activity.
Upvotes: 2