xiaocong / uiautomator

Python wrapper of Android uiautomator test tool.
MIT License
2.04k stars 645 forks source link

RPC server not started! #275

Open WangGuox1n opened 5 years ago

WangGuox1n commented 5 years ago

Here is the output

File "/home/shameng/PycharmProjects/Q-testing/Q-testing/qlearning_final_coverage.py", line 279, in get_current_state d.dump(self.current_ui_file_path) File "/usr/local/lib/python2.7/dist-packages/uiautomator/init.py", line 637, in dump content = self.server.jsonrpc.dumpWindowHierarchy(compressed, None) File "/usr/local/lib/python2.7/dist-packages/uiautomator/init.py", line 442, in wrapper server.start(timeout=30) File "/usr/local/lib/python2.7/dist-packages/uiautomator/init.py", line 498, in start raise IOError("RPC server not started!") IOError: RPC server not started!

And I have done as the FAQ and other issues said, but it doesn't work

$ curl -d '{"jsonrpc":"2.0","method":"deviceInfo","id":1}' localhost:9008/jsonrpc/0 {"jsonrpc":"2.0","id":1,"result":{"currentPackageName":"com.farmerbb.notepad","displayHeight":1184,"displayRotation":0,"displaySizeDpX":384,"displaySizeDpY":640,"displayWidth":768,"productName":"vbox86p","screenOn":true,"sdkInt":19,"naturalOrientation":true}}

here is the adb logcat (ERROR)

04-01 06:49:58.586 E/memtrack( 6661): Couldn't load memtrack module (No such file or directory) 04-01 06:49:58.586 E/android.os.Debug( 6661): failed to load memtrack module: -2 04-01 06:49:58.718 E/JavaBinder( 574): !!! FAILED BINDER TRANSACTION !!! 04-01 06:49:58.718 E/InputDispatcher( 574): channel '529aa90c com.farmerbb.notepad/com.farmerbb.notepad.MainActivity (server)' ~ Channel is unrecoverably broken and will be disposed! 04-01 06:49:59.050 E/EGL_emulation( 801): tid 801: eglSurfaceAttrib(1210): error 0x3009 (EGL_BAD_MATCH) 04-01 06:49:59.234 E/memtrack( 6686): Couldn't load memtrack module (No such file or directory) 04-01 06:49:59.234 E/android.os.Debug( 6686): failed to load memtrack module: -2 04-01 06:49:59.298 E/dalvikvm( 6697): Could not find class 'android.graphics.drawable.RippleDrawable', referenced from method android.support.v7.widget.AppCompatImageHelper.hasOverlappingRendering 04-01 06:49:59.314 E/dalvikvm( 6697): Could not find class 'android.app.ActivityManager$TaskDescription', referenced from method com.farmerbb.notepad.fragment.NoteListFragment.onResume 04-01 06:49:59.502 E/EGL_emulation( 6697): tid 6697: eglSurfaceAttrib(1210): error 0x3009 (EGL_BAD_MATCH) 04-01 06:49:59.502 E/OpenGLRenderer( 6697): Getting MAX_TEXTURE_SIZE from GradienCache 04-01 06:49:59.502 E/OpenGLRenderer( 6697): MAX_TEXTURE_SIZE: 16384 04-01 06:49:59.558 E/OpenGLRenderer( 6697): Getting MAX_TEXTURE_SIZE from Caches::initConstraints() 04-01 06:49:59.558 E/OpenGLRenderer( 6697): MAX_TEXTURE_SIZE: 16384

uiautomator 0.3.6 Android 4.4 API 19

WangGuox1n commented 5 years ago

Edit:

when I run as follow in terminal, it seems well

from uiautomator import Device d = Device('192.168.56.101:5555') d.dump() u'<?xml version=\'1.0\' encoding=\'UTF-8\' standalone=\'yes\' ?>\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n'

And I run my project in pycharm, it fail as "RPC server not started! "

d.dump(self.current_ui_file_path)