Android第一个app Hello world logcat错误

时间:2014-07-16 18:18:33

标签: android android-layout android-activity

我只是使用Ray wanderlich教程来创建我的第一个Android应用程序 - 一个基本的hello世界。该应用程序已在模拟器上成功启动,文本按预期显示。但是我不喜欢logcat中的错误。非常感谢有人帮我确定logcat意外行为的原因。

07-16 18:03:02.661    1353-1477/com.google.android.gms.wearable D/WearableConn﹕ Socket closed
07-16 18:03:03.021    1353-1477/com.google.android.gms.wearable D/WearableConn﹕ Waiting 4.0 seconds to retry connection
07-16 18:03:07.221    1353-1477/com.google.android.gms.wearable D/WearableConn﹕ Connecting via TCP to /10.0.2.2:5601
07-16 18:04:10.802    1353-1477/com.google.android.gms.wearable D/dalvikvm﹕ GC_FOR_ALLOC freed 500K, 21% free 2434K/3056K, paused 192ms, total 203ms
07-16 18:04:10.832    1353-1477/com.google.android.gms.wearable D/WearableConn﹕ Error writing to device
    java.net.ConnectException: failed to connect to /10.0.2.2 (port 5601): connect failed: ETIMEDOUT (Connection timed out)
            at libcore.io.IoBridge.connect(IoBridge.java:114)
            at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:192)
            at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
            at java.net.Socket.startupSocket(Socket.java:567)
            at java.net.Socket.<init>(Socket.java:226)
            at btx.run(SourceFile:130)
     Caused by: libcore.io.ErrnoException: connect failed: ETIMEDOUT (Connection timed out)
            at libcore.io.Posix.connect(Native Method)
            at libcore.io.BlockGuardOs.connect(BlockGuardOs.java:101)
            at libcore.io.IoBridge.connectErrno(IoBridge.java:127)
            at libcore.io.IoBridge.connect(IoBridge.java:112)
            at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:192)
            at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
            at java.net.Socket.startupSocket(Socket.java:567)
            at java.net.Socket.<init>(Socket.java:226)
            at btx.run(SourceFile:130)
07-16 18:04:11.072    1353-1477/com.google.android.gms.wearable D/WearableConn﹕ Socket closed
07-16 18:04:11.232    1353-1477/com.google.android.gms.wearable D/WearableConn﹕ Waiting 4.0 seconds to retry connection
07-16 18:04:15.312    1353-1477/com.google.android.gms.wearable D/WearableConn﹕ Connecting via TCP to /10.0.2.2:5601
07-16 18:05:18.643    1353-1477/com.google.android.gms.wearable D/WearableConn﹕ Error writing to device
    java.net.ConnectException: failed to connect to /10.0.2.2 (port 5601): connect failed: ETIMEDOUT (Connection timed out)
            at libcore.io.IoBridge.connect(IoBridge.java:114)
            at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:192)
            at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
            at java.net.Socket.startupSocket(Socket.java:567)
            at java.net.Socket.<init>(Socket.java:226)
            at btx.run(SourceFile:130)
     Caused by: libcore.io.ErrnoException: connect failed: ETIMEDOUT (Connection timed out)
            at libcore.io.Posix.connect(Native Method)
            at libcore.io.BlockGuardOs.connect(BlockGuardOs.java:101)
            at libcore.io.IoBridge.connectErrno(IoBridge.java:127)
            at libcore.io.IoBridge.connect(IoBridge.java:112)
            at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:192)
            at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
            at java.net.Socket.startupSocket(Socket.java:567)
            at java.net.Socket.<init>(Socket.java:226)
            at btx.run(SourceFile:130)
07-16 18:05:18.833    1353-1477/com.google.android.gms.wearable D/WearableConn﹕ Socket closed
07-16 18:05:18.993    1353-1477/com.google.android.gms.wearable D/WearableConn﹕ Waiting 4.0 seconds to retry connection
07-16 18:05:23.263    1353-1477/com.google.android.gms.wearable D/WearableConn﹕ Connecting via TCP to /10.0.2.2:5601
07-16 18:05:27.533    1247-1287/system_process D/ConnectivityService﹕ Sampling interval elapsed, updating statistics ..
07-16 18:05:27.753    1247-1287/system_process D/ConnectivityService﹕ Done.
07-16 18:05:27.763    1247-1287/system_process D/ConnectivityService﹕ Setting timer for 720seconds
07-16 18:06:10.304    1247-1247/system_process D/dalvikvm﹕ GC_FOR_ALLOC freed 415K, 11% free 4481K/5028K, paused 235ms, total 260ms
07-16 18:06:26.674    1353-1477/com.google.android.gms.wearable D/WearableConn﹕ Error writing to device
    java.net.ConnectException: failed to connect to /10.0.2.2 (port 5601): connect failed: ETIMEDOUT (Connection timed out)
            at libcore.io.IoBridge.connect(IoBridge.java:114)
            at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:192)
            at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
            at java.net.Socket.startupSocket(Socket.java:567)
            at java.net.Socket.<init>(Socket.java:226)
            at btx.run(SourceFile:130)
     Caused by: libcore.io.ErrnoException: connect failed: ETIMEDOUT (Connection timed out)
            at libcore.io.Posix.connect(Native Method)
            at libcore.io.BlockGuardOs.connect(BlockGuardOs.java:101)
            at libcore.io.IoBridge.connectErrno(IoBridge.java:127)
            at libcore.io.IoBridge.connect(IoBridge.java:112)
            at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:192)
            at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
            at java.net.Socket.startupSocket(Socket.java:567)
            at java.net.Socket.<init>(Socket.java:226)
            at btx.run(SourceFile:130)
07-16 18:06:26.824    1353-1477/com.google.android.gms.wearable D/WearableConn﹕ Socket closed
07-16 18:06:27.064    1353-1477/com.google.android.gms.wearable D/WearableConn﹕ Waiting 4.0 seconds to retry connection
07-16 18:06:31.314    1353-1477/com.google.android.gms.wearable D/WearableConn﹕ Connecting via TCP to /10.0.2.2:5601
07-16 18:07:34.675    1353-1477/com.google.android.gms.wearable D/WearableConn﹕ Error writing to device
    java.net.ConnectException: failed to connect to /10.0.2.2 (port 5601): connect failed: ETIMEDOUT (Connection timed out)
            at libcore.io.IoBridge.connect(IoBridge.java:114)
            at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:192)
            at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
            at java.net.Socket.startupSocket(Socket.java:567)
            at java.net.Socket.<init>(Socket.java:226)
            at btx.run(SourceFile:130)
     Caused by: libcore.io.ErrnoException: connect failed: ETIMEDOUT (Connection timed out)
            at libcore.io.Posix.connect(Native Method)
            at libcore.io.BlockGuardOs.connect(BlockGuardOs.java:101)
            at libcore.io.IoBridge.connectErrno(IoBridge.java:127)
            at libcore.io.IoBridge.connect(IoBridge.java:112)
            at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:192)
            at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
            at java.net.Socket.startupSocket(Socket.java:567)
            at java.net.Socket.<init>(Socket.java:226)
            at btx.run(SourceFile:130)
07-16 18:07:34.765    1353-1477/com.google.android.gms.wearable D/WearableConn﹕ Socket closed
07-16 18:07:34.875    1353-1477/com.google.android.gms.wearable D/WearableConn﹕ Waiting 4.0 seconds to retry connection
07-16 18:07:39.065    1353-1477/com.google.android.gms.wearable D/WearableConn﹕ Connecting via TCP to /10.0.2.2:5601
07-16 18:08:42.446    1353-1477/com.google.android.gms.wearable D/WearableConn﹕ Error writing to device
    java.net.ConnectException: failed to connect to /10.0.2.2 (port 5601): connect failed: ETIMEDOUT (Connection timed out)
            at libcore.io.IoBridge.connect(IoBridge.java:114)
            at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:192)
            at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
            at java.net.Socket.startupSocket(Socket.java:567)
            at java.net.Socket.<init>(Socket.java:226)
            at btx.run(SourceFile:130)
     Caused by: libcore.io.ErrnoException: connect failed: ETIMEDOUT (Connection timed out)
            at libcore.io.Posix.connect(Native Method)
            at libcore.io.BlockGuardOs.connect(BlockGuardOs.java:101)
            at libcore.io.IoBridge.connectErrno(IoBridge.java:127)
            at libcore.io.IoBridge.connect(IoBridge.java:112)
            at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:192)
            at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
            at java.net.Socket.startupSocket(Socket.java:567)
            at java.net.Socket.<init>(Socket.java:226)
            at btx.run(SourceFile:130)
07-16 18:08:42.486    1353-1477/com.google.android.gms.wearable D/WearableConn﹕ Socket closed
07-16 18:08:42.576    1353-1477/com.google.android.gms.wearable D/WearableConn﹕ Waiting 4.0 seconds to retry connection
07-16 18:08:46.696    1353-1477/com.google.android.gms.wearable D/WearableConn﹕ Connecting via TCP to /10.0.2.2:5601

1 个答案:

答案 0 :(得分:0)

打开命令提示符并键入命令netstat并检查端口5601是否已打开。如果它在那里然后打开另一个命令提示符并键入以下命令 telnet localhost 5554

连接后

输入

redir add tcp:5601:6000

和 退出

检查是否有帮助..