unlock android emulator from cmd line

后端 未结 4 1730
被撕碎了的回忆
被撕碎了的回忆 2021-01-01 04:15

I would like to run android emulator from cmd line - unlock it and control it. Is this possible ?

I know how to operate from eclipse?

相关标签:
4条回答
  • 2021-01-01 04:44

    You should take a look at the monkeyrunner tool which will allow you to do this:

    http://developer.android.com/guide/developing/tools/monkeyrunner_concepts.html

    0 讨论(0)
  • 2021-01-01 04:47

    You can interact with the emulator via its console interface.

    If you ever wondered why your emulator started with a number like 5554 - that's because that's the port the emulator listening on.

    You can find the port for running emulators with the adb devices command. It will have output like this:

    C:>adb devices List of devices attached emulator-5554 device So you can connect to the emulator using a command like:

    telnet localhost 5554 If you connect successfully you'll get an OK prompt and you can start entering commands.

    There are various commands but the one we are interested in is event to simulate hardware events. We can unlock the screen by pressing Menu which we emulate with the following command:

    event send EV_KEY:KEY_MENU:1 EV_KEY:KEY_MENU:0

    0 讨论(0)
  • 2021-01-01 04:52

    On emulator try adb shell input keyevent 82. This keyevent execute KEYCODE_MENU and unlock a screen.

    0 讨论(0)
  • 2021-01-01 04:57

    In case you want to use AndroidViewClient/culebra this script will do it:

    #! /usr/bin/env python
    from com.dtmilano.android.viewclient import ViewClient
    
    
    device, serialno = ViewClient.connectToDeviceOrExit()
    device.unlock()
    
    0 讨论(0)
提交回复
热议问题