在android上使用Net.WebSocket的“java.lang.UnsupportedOperationException”

时间:2013-01-01 15:09:10

标签: java android playn

我只是想连接到我的websocket服务器:

ws = net().createWebSocket("ws://192.168.0.3:8000/sample", this);

使用 mvn test -Pjava

进行测试时效果很好

但是当我用我的谷歌Nexus S(在冰淇淋三明治下)加载它时,我得到:

E/AndroidRuntime( 4321): FATAL EXCEPTION: GLThread 352
E/AndroidRuntime( 4321): java.lang.UnsupportedOperationException
E/AndroidRuntime( 4321):        at playn.core.NetImpl.createWebSocket(NetImpl.java:27) 
E/AndroidRuntime( 4321):        at com.github.dawicorti.qrcomsample.core.CommunicationScreen.<init>(CommunicationScreen.java:34)
E/AndroidRuntime( 4321):        at com.github.dawicorti.qrcomsample.core.QRComSample.init(QRComSample.java:12)
E/AndroidRuntime( 4321):        at playn.android.AndroidPlatform.run(AndroidPlatform.java:170)
E/AndroidRuntime( 4321):        at playn.core.PlayN.run(PlayN.java:47)
E/AndroidRuntime( 4321):        at com.github.dawicorti.qrcomsample.android.QRComSampleActivity.main(QRComSampleActivity.java:13)
E/AndroidRuntime( 4321):        at playn.android.GameViewGL$3.run(GameViewGL.java:94)
E/AndroidRuntime( 4321):        at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1462)
E/AndroidRuntime( 4321):        at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240)
W/ActivityManager(  249):   Force finishing activity com.github.dawicorti.qrcomsample.android/.QRComSampleActivity

1 个答案:

答案 0 :(得分:0)

WebSockets(截至2013年3月),Android后端不支持。它们仅在Java和HTML后端中受支持。

我将更新平台状态页面。