你好 在我的android應用程序中,我試圖運行一個使用GPRS連接而不是WIFI的應用程序。 當試圖運行在WiFi的應用程序運行良好。 瀏覽器可以正常使用APN設置,但是當嘗試使用我的應用程序連接到服務器時,它會給我套接字異常。套接字異常套接字未連接android
我在清單文件中使用下面的權限。
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"></uses-permission>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"></uses- permission>
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE"></uses-permission>
<uses-permission android:name= "android.permission.CHANGE_NETWORK_STATE"></uses-permission>
<uses-permission android:name= "android.permission.WRITE_APN_SETTINGS" ></uses-permission>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" ></uses-permission>
我正在接收套接字未連接異常。 是否有任何其他許可,我需要添加使用除WIFI以外的GPRS連接。
日誌細節
10-27 18:26:19.689:WARN/CalSyncSvc(166):com.motorola.blur.service.email.protocol.activesync.ASException:問題執行HTTP POST 10 -27 18:26:19.689:WARN/CalSyncSvc(166):at com.motorola.blur.service.email.protocol.activesync.ActiveSyncMgr.sendRequest(Unknown Source) 10-27 18:26:19.689:WARN/CalSyncSvc (166):at com.motorola.blur.service.email.protocol.activesync.ActiveSyncMgr.sendXMLCommandNoProvisoning(Unknown Source) 10-27 18:26:19.689:WARN/CalSyncSvc(166):at com.motorola.blur。 service.email.protocol.activesync.ActiveSyncMgr.sendXMLCommand0(未知來源) 10-27 18:26:19.689:WARN/CalSyncSvc(166):at com.motorola.blur.service.email.protocol.activesync.ActiveSyncMgr.sendXMLCommand(Unknown Source) 10-27 18:26:19.689:WARN/CalSyncSvc(166):at com.motorola.blur.service.email.protocol.activesync.ActiveSyncMgr.sendFolderSyncCommand(Unknown Source) 10-27 18:26:19.689:WARN/CalSyncSvc(166):at com.motorola。 blur.service.email.protocol.activesync.ProviderAPI.sendFolderSync(Unknown Source) 10-27 18:26:19.689:WARN/CalSyncSvc(166):at com.motorola.blur.service.email.protocol.activesync.ProviderAPI .updateMapFromFolderSync(Unknown Source) 10-27 18:26:19.689:WARN/CalSyncSvc(166):at com.motorola.blur.service.email.protocol.activesync.ProviderAPI.updateFromFolderSync(Unknown Source) 10-27 18 :26:19.689:WARN/CalSyncSvc(166):at com.motorola.blur.calendar.sync.activesync.Sync Service.syncAccount(Unknown Source) 10-27 18:26:19.689:WARN/CalSyncSvc(166):at com.motorola.blur.calendar.sync.activesync.SyncService $ QueueEntry.run(Unknown Source) 10-27 18:26:19.689:WARN/CalSyncSvc(166):在java.util.concurrent.Executors $ RunnableAdapter.call(Executors.java:416) 10-27 18:26:19.689:WARN/CalSyncSvc(166):at java.util.concurrent.FutureTask $ Sync.innerRun(FutureTask.java:256) 10-27 18:26:19.689:WARN/CalSyncSvc(166):在java.util.concurrent.FutureTask.run(FutureTask.java: 122) 10-27 18:26:19.689:WARN/CalSyncSvc(166):at java.util.concurrent.ThreadPoolExecutor $ Worker.runTask(ThreadPoolExecutor.java:648) 10-27 18:26:19.689:WARN/CalSyncSvc(166):在java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:673) 10-27 18:26:19.689 :WARN/CalSyncSvc(166):at java.lang.Thread.run(Thread.java:1058) 10-27 18:26:19.689:WARN/CalSyncSvc(166):at com.motorola.blur.util.concurrent .BlurThreadFactory $ BlurPooledThread.run(未知源) 10-27 18:26:19.689:WARN/CalSyncSvc(166):導致:java.net.SocketTimeoutException:套接字未連接 10-27 18:26:19.689: WARN/CalSyncSvc(166):at org.apache.harmony.luni.platform.OSNetworkSystem.connectStreamWithTimeoutSocketImpl(Native Method) 10-27 18:26:19.689:WARN/CalSyncSvc(166):at org.apache.harmony.luni .platform.OSNetworkSystem.connectStreamWithTimeoutSocket(OSNetworkSystem.java:140) 10-27 18:26:19.689:WARN/CalSyncSvc(166):at org.apache.harmony.luni.net.PlainSocketImpl.connect(PlainSocketImpl。java:229) 10-27 18:26:19.689:WARN/CalSyncSvc(166):at org.apache.harmony.luni.net.PlainSocketImpl.connect(PlainSocketImpl.java:521) 10-27 18:26: 19.689:WARN/CalSyncSvc(166):在java.net.Socket.connect(Socket.java:1019) 10-27 18:26:19.689:WARN/CalSyncSvc(166):at org.apache.http.conn。 ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:317) 10-27 18:26:19.689:WARN/CalSyncSvc(166):at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:129) 10-27 18:26:19.689:WARN/CalSyncSvc(166):at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:164) 10-27 18:26:19.689:WARN/CalSyncSvc(166):at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:119) 10 -27 18:26:19.689:WARN/CalSyncSvc(166):at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:348) 10-27 18:26:19.689:WARN/CalSyncSvc 166):at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:555) 10-27 18:26:19.689:WARN/CalSyncSvc(166):at org.apache.http.impl。 client.AbstractHttpClient.execute(AbstractHttpClient.java:487) 10-27 18:26:19.689:WARN/CalSyncSvc(166):at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:465) 10-27 18:26:19.689:WARN/CalSyncSvc(166):... 17更多 請讓我知道您的寶貴建議。
感謝提前:)
將stacktrace添加到您的問題 – KevinDTimm 2010-10-27 12:36:09
已編輯與日誌的問題。 – Remmyabhavan 2010-10-27 13:07:30