Appium无法找到Android Emulator /设备,无法运行代码

时间:2013-12-17 06:44:05

标签: android eclipse android-emulator device appium

无法在模拟器/设备上运行代码。 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

2 个答案:

答案 0 :(得分: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具有权限。

答案 1 :(得分:0)

这就解决了我的问题 -

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

中添加这样的路径

当Appium / ADB读取和扩展System32文件夹时出现问题。