0

尝试使用示例程序通过模拟器启动 Appium。

输出:

debug: executing: "C:\Program Files (x86)\Android\android-studio\sdk\platform-tools\adb.exe" -s emulator-5554 install C:\Program Files\Appium\node_modules\appium\build\unlock_apk\unlock_apk-debug.apk
warn:  killed=false, code=1, signal=null
info: Stopping logcat capture
info: Sent shutdown command, waiting for UiAutomator to stop...
warn: UiAutomator did not shut down fast enough, calling it gone
info: Cleaning up android objects
info: Cleaning up appium session
error: Failed to start an Appium session, err was: Error: Command failed: can't find 'C:\Program' to install

info: Responding to client with error: {"status":33,"value":{"message":"A new session could not be created. (Original error: Command failed: can't find 'C:\\Program' to install\r\n)","killed":false,"code":1,"signal":null,"origValue":"Command failed: can't find 'C:\\Program' to install\r\n"},"sessionId":null}
POST /wd/hub/session 500 11733ms - 316b

尝试使用已安装 apk 的模拟器和新的模拟器,得到相同的结果。

代码:

DesiredCapabilities caps = new DesiredCapabilities();
    caps.SetCapability("device", "Android");
    caps.SetCapability("browserName", "");
    caps.SetCapability("app-activity", "MainActivity");
    caps.SetCapability(CapabilityType.Version, "4.2");
    caps.SetCapability("app-package", "com.example.android.interactivechart");
    caps.SetCapability("app", @"C:\scm\InteractiveChart\out\production\InteractiveChart\InteractiveChart.apk");

RemoteWebDriver driver = new RemoteWebDriver(new Uri("http://127.0.0.1:4723/wd/hub"), caps, new TimeSpan(0,5,0)); //error here

有谁知道它为什么这样做?我环顾四周,找不到任何东西。这可能很简单,但 'C:\Program' 把我扔了,因为我没有传递任何包含它的东西。

编辑:添加 windows 标签作为默认安装位置是问题的根源

4

1 回答 1

1

我对Appium一无所知,但似乎目录名称有问题,使用某些命令行工具时目录不应有空格,将Android sdk和Appium文件夹移动到没有空格的目录(如到 C:) 并尝试使用该目录的命令。

于 2014-02-11T09:54:47.067 回答