1

无法在模拟器/设备上运行代码。Appium 未找到任何设备,但 cmd 列出了设备。

node.js 控制台提供:

info: Welcome to Appium v0.12.0 (REV a9d21807874190ae6d19f8251375cfe4da7b2ae5)

info: Appium REST http interface listener started on 127.0.0.1:4723

   info  - socket.io started

debug: Appium request initiated at /wd/hub/session

debug: Request received with params: {"desiredCapabilities":{"platform":"Windows

","browserName":"Android","app-package":"com.android.calculator2","app-activity"

:"com.android.calculator2.Calculator","version":"4.3"}}

warn: WARNING: use of browserName is deprecated. Please migrate your tests

info: Didn't get app but did get Android package, will attempt to launch it on t

he device

info: Creating new appium session 82c07566-3e62-4c64-a505-0d31ffe40089

info: Starting android appium

debug: Using fast reset? false
info: Preparing device for session

info: Not checking whether app is present since we are assuming it's already on
the device

info: Checking whether adb is present

info: [ADB] Using adb from C:\adt-bundle-windows-x86_64-20131030\sdk\platform-to

ols\adb.exe

info: Trying to find a connected android device

info: [ADB] Getting connected devices...

debug: executing: "C:\adt-bundle-windows-x86_64-20131030\sdk\platform-tools\adb.

exe" devices

warn:  code=ENOENT, errno=ENOENT, syscall=spawn

info: Could not find devices, restarting adb server...

debug: executing: "C:\adt-bundle-windows-x86_64-20131030\sdk\platform-tools\adb.

exe" kill-server

warn:  code=ENOENT, errno=ENOENT, syscall=spawn

error: Error killing ADB server, going to see if it's online anyway

info: [ADB] Getting connected devices...

debug: executing: "C:\adt-bundle-windows-x86_64-20131030\sdk\platform-tools\adb.

exe" devices

warn:  code=ENOENT, errno=ENOENT, syscall=spawn

info: Could not find devices, restarting adb server...

debug: executing: "C:\adt-bundle-windows-x86_64-20131030\sdk\platform-tools\adb.

exe" kill-server

warn:  code=ENOENT, errno=ENOENT, syscall=spawn

error: Error killing ADB server, going to see if it's online anyway

info: [ADB] Getting connected devices...

debug: executing: "C:\adt-bundle-windows-x86_64-20131030\sdk\platform-tools\adb.

exe" devices

warn:  code=ENOENT, errno=ENOENT, syscall=spawn

info: Could not find devices, restarting adb server...

debug: executing: "C:\adt-bundle-windows-x86_64-20131030\sdk\platform-tools\adb.

exe" kill-server

warn:  code=ENOENT, errno=ENOENT, syscall=spawn

error: Error killing ADB server, going to see if it's online anyway

info: [ADB] Getting connected devices...

debug: executing: "C:\adt-bundle-windows-x86_64-20131030\sdk\platform-tools\adb.

exe" devices

warn:  code=ENOENT, errno=ENOENT, syscall=spawn

info: Could not find devices, restarting adb server...

debug: executing: "C:\adt-bundle-windows-x86_64-20131030\sdk\platform-tools\adb.

exe" kill-server

warn:  code=ENOENT, errno=ENOENT, syscall=spawn

error: Error killing ADB server, going to see if it's online anyway

info: [ADB] Getting connected devices...

debug: executing: "C:\adt-bundle-windows-x86_64-20131030\sdk\platform-tools\adb.

exe" devices

warn:  code=ENOENT, errno=ENOENT, syscall=spawn

info: Could not find devices, restarting adb server...

debug: executing: "C:\adt-bundle-windows-x86_64-20131030\sdk\platform-tools\adb.

exe" kill-server

warn:  code=ENOENT, errno=ENOENT, syscall=spawn

error: Error killing ADB server, going to see if it's online anyway

info: [ADB] Getting connected devices...

debug: executing: "C:\adt-bundle-windows-x86_64-20131030\sdk\platform-tools\adb.

exe" devices

warn:  code=ENOENT, errno=ENOENT, syscall=spawn

info: Could not find devices, restarting adb server...

debug: executing: "C:\adt-bundle-windows-x86_64-20131030\sdk\platform-tools\adb.

exe" kill-server

warn:  code=ENOENT, errno=ENOENT, syscall=spawn

error: Error killing ADB server, going to see if it's online anyway

info: [ADB] Getting connected devices...

debug: executing: "C:\adt-bundle-windows-x86_64-20131030\sdk\platform-tools\adb.

exe" devices

warn:  code=ENOENT, errno=ENOENT, syscall=spawn

info: Could not find devices, restarting adb server...

debug: executing: "C:\adt-bundle-windows-x86_64-20131030\sdk\platform-tools\adb.

exe" kill-server

warn:  code=ENOENT, errno=ENOENT, syscall=spawn

error: Error killing ADB server, going to see if it's online anyway

info: [ADB] Getting connected devices...

debug: executing: "C:\adt-bundle-windows-x86_64-20131030\sdk\platform-tools\adb.

exe" devices

warn:  code=ENOENT, errno=ENOENT, syscall=spawn

info: Could not find devices, restarting adb server...

debug: executing: "C:\adt-bundle-windows-x86_64-20131030\sdk\platform-tools\adb.

exe" kill-server

warn:  code=ENOENT, errno=ENOENT, syscall=spawn

error: Error killing ADB server, going to see if it's online anyway

info: [ADB] Getting connected devices...

debug: executing: "C:\adt-bundle-windows-x86_64-20131030\sdk\platform-tools\adb.
exe" devices

warn:  code=ENOENT, errno=ENOENT, syscall=spawn

info: Could not find devices, restarting adb server...

debug: executing: "C:\adt-bundle-windows-x86_64-20131030\sdk\platform-tools\adb.

exe" kill-server

warn:  code=ENOENT, errno=ENOENT, syscall=spawn

error: Error killing ADB server, going to see if it's online anyway

info: [ADB] Getting connected devices...

debug: executing: "C:\adt-bundle-windows-x86_64-20131030\sdk\platform-tools\adb.

exe" devices

warn:  code=ENOENT, errno=ENOENT, syscall=spawn

info: Could not find devices, restarting adb server...

debug: executing: "C:\adt-bundle-windows-x86_64-20131030\sdk\platform-tools\adb.

exe" kill-server

warn:  code=ENOENT, errno=ENOENT, syscall=spawn

error: Error killing ADB server, going to see if it's online anyway

info: [ADB] Getting connected devices...

debug: executing: "C:\adt-bundle-windows-x86_64-20131030\sdk\platform-tools\adb.

exe" devices

warn:  code=ENOENT, errno=ENOENT, syscall=spawn

info: Could not find devices, restarting adb server...

debug: executing: "C:\adt-bundle-windows-x86_64-20131030\sdk\platform-tools\adb.

exe" kill-server
warn:  code=ENOENT, errno=ENOENT, syscall=spawn

error: Error killing ADB server, going to see if it's online anyway

info: [ADB] Getting connected devices...

debug: executing: "C:\adt-bundle-windows-x86_64-20131030\sdk\platform-tools\adb.

exe" devices

warn:  code=ENOENT, errno=ENOENT, syscall=spawn
info: Could not find devices, restarting adb server...

debug: executing: "C:\adt-bundle-windows-x86_64-20131030\sdk\platform-tools\adb.

exe" kill-server

warn:  code=ENOENT, errno=ENOENT, syscall=spawn

error: Error killing ADB server, going to see if it's online anyway

info: [ADB] Getting connected devices...
debug: executing: "C:\adt-bundle-windows-x86_64-20131030\sdk\platform-tools\adb.

exe" devices

warn:  code=ENOENT, errno=ENOENT, syscall=spawn

info: Could not find devices, restarting adb server...

debug: executing: "C:\adt-bundle-windows-x86_64-20131030\sdk\platform-tools\adb.

exe" kill-server
warn:  code=ENOENT, errno=ENOENT, syscall=spawn

error: Error killing ADB server, going to see if it's online anyway

info: [ADB] Getting connected devices...
debug: executing: "C:\adt-bundle-windows-x86_64-20131030\sdk\platform-tools\adb.

exe" devices

warn:  code=ENOENT, errno=ENOENT, syscall=spawn

info: Could not find devices, restarting adb server...
debug: executing: "C:\adt-bundle-windows-x86_64-20131030\sdk\platform-tools\adb.

exe" kill-server

warn:  code=ENOENT, errno=ENOENT, syscall=spawn

error: Error killing ADB server, going to see if it's online anyway
info: [ADB] Getting connected devices...

debug: executing: "C:\adt-bundle-windows-x86_64-20131030\sdk\platform-tools\adb.

exe" devices

warn:  code=ENOENT, errno=ENOENT, syscall=spawn

info: Could not find devices, restarting adb server...
debug: executing: "C:\adt-bundle-windows-x86_64-20131030\sdk\platform-tools\adb.

exe" kill-server

warn:  code=ENOENT, errno=ENOENT, syscall=spawn

error: Error killing ADB server, going to see if it's online anyway

info: [ADB] Getting connected devices...

debug: executing: "C:\adt-bundle-windows-x86_64-20131030\sdk\platform-tools\adb.

exe" devices

warn:  code=ENOENT, errno=ENOENT, syscall=spawn

info: Could not find devices, restarting adb server...

debug: executing: "C:\adt-bundle-windows-x86_64-20131030\sdk\platform-tools\adb.

exe" kill-server

warn:  code=ENOENT, errno=ENOENT, syscall=spawn

error: Error killing ADB server, going to see if it's online anyway

info: [ADB] Getting connected devices...

debug: executing: "C:\adt-bundle-windows-x86_64-20131030\sdk\platform-tools\adb.

exe" devices

warn:  code=ENOENT, errno=ENOENT, syscall=spawn

info: Could not find devices, restarting adb server...

debug: executing: "C:\adt-bundle-windows-x86_64-20131030\sdk\platform-tools\adb.

exe" kill-server

warn:  code=ENOENT, errno=ENOENT, syscall=spawn

error: Error killing ADB server, going to see if it's online anyway

info: [ADB] Getting connected devices...

debug: executing: "C:\adt-bundle-windows-x86_64-20131030\sdk\platform-tools\adb.

exe" devices

warn:  code=ENOENT, errno=ENOENT, syscall=spawn

info: Could not find devices, restarting adb server...

debug: executing: "C:\adt-bundle-windows-x86_64-20131030\sdk\platform-tools\adb.

exe" kill-server

warn:  code=ENOENT, errno=ENOENT, syscall=spawn

error: Error killing ADB server, going to see if it's online anyway

info: [ADB] Getting connected devices...

debug: executing: "C:\adt-bundle-windows-x86_64-20131030\sdk\platform-tools\adb.

exe" devices

warn:  code=ENOENT, errno=ENOENT, syscall=spawn

info: Could not find devices, restarting adb server...

debug: executing: "C:\adt-bundle-windows-x86_64-20131030\sdk\platform-tools\adb.

exe" kill-server

warn:  code=ENOENT, errno=ENOENT, syscall=spawn
error: Error killing ADB server, going to see if it's online anyway

info: [ADB] Getting connected devices...

debug: executing: "C:\adt-bundle-windows-x86_64-20131030\sdk\platform-tools\adb.

exe" devices

warn:  code=ENOENT, errno=ENOENT, syscall=spawn

info: Could not find devices, restarting adb server...

debug: executing: "C:\adt-bundle-windows-x86_64-20131030\sdk\platform-tools\adb.

exe" kill-server

warn:  code=ENOENT, errno=ENOENT, syscall=spawn

error: Error killing ADB server, going to see if it's online anyway

info: [ADB] Getting connected devices...

debug: executing: "C:\adt-bundle-windows-x86_64-20131030\sdk\platform-tools\adb.

exe" devices

warn:  code=ENOENT, errno=ENOENT, syscall=spawn

POST /wd/hub/session 200 599985ms

debug: Appium request initiated at /wd/hub/session

debug: Request received with params: {"desiredCapabilities":{"platform":"Windows

","browserName":"Android","app-package":"com.android.calculator2","app-activity"

:"com.android.calculator2.Calculator","version":"4.3"}}

warn: WARNING: use of browserName is deprecated. Please migrate your tests

info: Didn't get app but did get Android package, will attempt to launch it on t

he device

error: Failed to start an Appium session, err was: Error: Requested a new sessio

n but one was in progress

info: Responding to client with error: {"status":33,"value":{"message":"A new se

ssion could not be created. (Original error: Requested a new session but one was

 in progress)","origValue":"Requested a new session but one was in progress"},"s

essionId":"82c07566-3e62-4c64-a505-0d31ffe40089"}

POST /wd/hub/session 500 55ms - 278b
4

2 回答 2

0

例子 :

File appDir = new File("<.apk location>");
File app = new File(appDir, "apkname.apk");
DesiredCapabilities capabilities = new DesiredCapabilities();
            capabilities.setCapability("device","Android");
            capabilities.setCapability(CapabilityType.BROWSER_NAME, "");
            capabilities.setCapability(CapabilityType.VERSION, "4.3");
            capabilities.setCapability(CapabilityType.PLATFORM, "LINUX");
        capabilities.setCapability("app-package","pkg name"); // from manifest file
capabilities.setCapability("app-activity","activity name");//from Manifest file
capabilities.setCapability("app", app.getAbsolutePath());
driver = new RemoteWebDriver(new URL("http://localhost:4723/wd/hub"), capabilities);

确保提供完整的包和活动名称,并且 .apk 具有权限。

于 2014-01-24T13:35:14.550 回答
0

这就是解决我的问题的方法-

打开命令提示符并键入路径。检查此路径是否存在 C:\WINDOWS\system32。如果没有,请转到步骤 3。在系统变量 %SYSTEMROOT%\System32 中添加这样的路径

当 Appium/ADB 在读取和扩展 System32 文件夹时出现问题时会发生这种情况。

于 2014-09-26T00:25:33.960 回答