0

我使用 libnodave 库(Java 版本)从 android 设备连接到 PLC(S7-300)。在 Eclipse 中编写项目。当我尝试连接时,会出现连接错误。这是日志文件:

10-31 11:37:48.378: E/SensorManager(31926): thread start
10-31 11:38:20.953: E/AndroidRuntime(31926): FATAL EXCEPTION: main
10-31 11:38:20.953: E/AndroidRuntime(31926): java.lang.IllegalStateException: Could not execute method of the activity
10-31 11:38:20.953: E/AndroidRuntime(31926):    at android.view.View$1.onClick(View.java:3704)
10-31 11:38:20.953: E/AndroidRuntime(31926):    at android.view.View.performClick(View.java:4232)
10-31 11:38:20.953: E/AndroidRuntime(31926):    at android.view.View$PerformClick.run(View.java:17298)
10-31 11:38:20.953: E/AndroidRuntime(31926):    at android.os.Handler.handleCallback(Handler.java:615)
10-31 11:38:20.953: E/AndroidRuntime(31926):    at android.os.Handler.dispatchMessage(Handler.java:92)
10-31 11:38:20.953: E/AndroidRuntime(31926):    at android.os.Looper.loop(Looper.java:137)
10-31 11:38:20.953: E/AndroidRuntime(31926):    at android.app.ActivityThread.main(ActivityThread.java:4921)
10-31 11:38:20.953: E/AndroidRuntime(31926):    at java.lang.reflect.Method.invokeNative(Native Method)
10-31 11:38:20.953: E/AndroidRuntime(31926):    at java.lang.reflect.Method.invoke(Method.java:511)
10-31 11:38:20.953: E/AndroidRuntime(31926):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1027)
10-31 11:38:20.953: E/AndroidRuntime(31926):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:794)
10-31 11:38:20.953: E/AndroidRuntime(31926):    at dalvik.system.NativeStart.main(Native Method)
10-31 11:38:20.953: E/AndroidRuntime(31926): Caused by: java.lang.reflect.InvocationTargetException
10-31 11:38:20.953: E/AndroidRuntime(31926):    at java.lang.reflect.Method.invokeNative(Native Method)
10-31 11:38:20.953: E/AndroidRuntime(31926):    at java.lang.reflect.Method.invoke(Method.java:511)
10-31 11:38:20.953: E/AndroidRuntime(31926):    at android.view.View$1.onClick(View.java:3699)
10-31 11:38:20.953: E/AndroidRuntime(31926):    ... 11 more
10-31 11:38:20.953: E/AndroidRuntime(31926): Caused by: android.os.NetworkOnMainThreadException
10-31 11:38:20.953: E/AndroidRuntime(31926):    at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1118)
10-31 11:38:20.953: E/AndroidRuntime(31926):    at libcore.io.BlockGuardOs.connect(BlockGuardOs.java:84)
10-31 11:38:20.953: E/AndroidRuntime(31926):    at libcore.io.IoBridge.connectErrno(IoBridge.java:127)
10-31 11:38:20.953: E/AndroidRuntime(31926):    at libcore.io.IoBridge.connect(IoBridge.java:112)
10-31 11:38:20.953: E/AndroidRuntime(31926):    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:192)
10-31 11:38:20.953: E/AndroidRuntime(31926):    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
10-31 11:38:20.953: E/AndroidRuntime(31926):    at java.net.Socket.startupSocket(Socket.java:566)
10-31 11:38:20.953: E/AndroidRuntime(31926):    at java.net.Socket.tryAllAddresses(Socket.java:127)
10-31 11:38:20.953: E/AndroidRuntime(31926):    at java.net.Socket.<init>(Socket.java:177)
10-31 11:38:20.953: E/AndroidRuntime(31926):    at java.net.Socket.<init>(Socket.java:149)
10-31 11:38:20.953: E/AndroidRuntime(31926):    at nodave.DataIsoTCP.<init>(DataIsoTCP.java:29)
10-31 11:38:20.953: E/AndroidRuntime(31926):    at nodave.DataIsoTCP.ConnectIsoTcp(DataIsoTCP.java:90)
10-31 11:38:20.953: E/AndroidRuntime(31926):    at com.example.s7nodavetest.MainActivity.makeConnection(MainActivity.java:45)

请帮帮我!

4

0 回答 0