当我尝试使用Appium测试我的Hello World Android应用时,我得到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]
,唤醒设备获取4724
,确保屏幕解锁... 然后它执行{"value":true,"status":0}
并给出上面的错误消息。
它也尝试。前置于活动并给出相同的错误消息。
答案 0 :(得分:2)
我发现如果应用程序已安装之前来运行我的测试,则不会抱怨该活动缺席。
如果我使用appium --full-reset
启动appium,它会卸载现有应用,然后安装一些 apk并找到活动。
答案 1 :(得分:1)
检查相应应用程序中 .java 或 .kt 中的包名称是否与 XML 包名称中的相同。
例如: XML - 工具:上下文=“com.example.emptyname.MainActivity” kt - 包 com.example.emptyname
答案 2 :(得分:0)
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");