Appium [已解决]麻烦看一下 appium 在真机运行找不到

中年_Brain · 2014年05月09日 · 最后由 大东 回复于 2014年05月09日 · 2073 次阅读

We tried to start an activity that doesn't exist, retrying with . prepended to activity

遇见这样的报错怎么办。。

我在模拟器上是可以的,app 我已经去掉了签名,机器没有 root,求大神给我一个方向

ERROR: debug: executing: "D:\adt-bundle-windows-x86_64-20140321\sdk\platform-tools\adb.exe" -s 524c4d8a shell "dumpsys window windows"
info: Getting focused package and activity

共收到 16 条回复 时间 点赞

ERROR: debug: executing: "D:\adt-bundle-windows-x86_64-20140321\sdk\platform-tools\adb.exe" -s 524c4d8a shell "dumpsys window windows"
info: Getting focused package and activity

我自己在手机里面点开 APP ,测试程序跑成功了。。
为什么启动不了这个 APP???

#3 楼 @anikikun
// new 1.0 vison
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(CapabilityType.BROWSER_NAME, "");
capabilities.setCapability(CapabilityType.VERSION, "4.1.2");
capabilities.setCapability("device", "Selendroid"); //Selendroid Android
capabilities.setCapability("app", app.getAbsolutePath());
capabilities.setCapability("appPackage", "android.view");
capabilities.setCapability("appActivity", "HomeActivity");
driver = new AppiumDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);

若包名确认没错的话,Activity 名前面加个点,如下

capabilities.setCapability("appActivity", ".HomeActivity");

ERROR: debug: Screen already unlocked, continuing.
info: Pushing command to appium work queue: ["getDataDir",{}]
info: [BOOTSTRAP] [info] Got data from client: {"cmd":"action","action":"getDataDir","params":{}}
info: [BOOTSTRAP] [info] Got command of type ACTION
ERROR: debug: dataDir set to: /data/local/tmp
info: [BOOTSTRAP] [debug] Got command action: getDataDir
ERROR: debug: executing: "D:\adt-bundle-windows-x86_64-20140321\sdk\platform-tools\adb.exe" -s 524c4d8a shell "am start -S -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -f 0x10200000 -n android.view/HomeActivity"
info: [BOOTSTRAP] [info] Returning result: {"value":"\/data\/local\/tmp","status":0}
info: We tried to start an activity that doesn't exist, retrying with . prepended to activity
ERROR: debug: executing: "D:\adt-bundle-windows-x86_64-20140321\sdk\platform-tools\adb.exe" -s 524c4d8a shell "am start -S -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -f 0x10200000 -n android.view/HomeActivity"
info: Waiting for activity to be focused

模拟器里面都可以运行。。

这个是不是没有 root,是 adb 权限问题?

#5 楼 @anikikun

info: Getting focused package and activity
ERROR: debug: executing: "D:\adt-bundle-windows-x86_64-20140321\sdk\platform-tools\adb.exe" -s 524c4d8a shell "dumpsys window windows"

你 adb devices 能看到连接的真机么

#9 楼 @eric
List of devices attached
524c4d8a device
emulator-5554 device

你怎么会有 2 个设备在呢 这样的话你要么启动 appium 的时候指定设备 要么就连一个设备

#11 楼 @eric
因为有一个是模拟器,我运行的时候是把模拟器关闭的

capabilities.setCapability("appActivity", "HomeActivity");
这个 HomeAcivity 是指的 APP 昵称,还是什么啊?

#14 楼 @zhaomiaoqq
已经正常运行了,这个是 app 的活跃窗口,利用 hierarchyviewer 查看

大侠们! 我现在这里也出现这个问题了,但是我没解决,模拟器可以正常运行,连接真机就报错,请问是什么原因

需要 登录 后方可回复, 如果你还没有账号请点击这里 注册