gpt4 book ai didi

java - 连接到 maps.googleapis.com 的 Android TimeoutException

转载 作者:行者123 更新时间:2023-11-30 03:43:36 25 4
gpt4 key购买 nike

我正在开发一个使用 google api 服务的 android 应用程序。

当我在家中使用 wifi 发出请求时,一切正常,但当我在企业网络中时,请求失败。

logcat 提取

03-12 09:51:36.279: W/System.err(1213): java.net.SocketTimeoutException: failed          
to connect to maps.googleapis.com/74.125.132.95 (port 443) after 20000ms 03-12
09:51:36.299: W/System.err(1213): at libcore.io.IoBridge.connectErrno(IoBridge.java:159)
03-12 09:51:36.379: W/System.err(1213): at libcore.io.IoBridge.connect(IoBridge.java:112)
03-12 09:51:36.389: W/System.err(1213): at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:192)
03-12 09:51:36.389: W/System.err(1213): at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:459)
03-12 09:51:36.399: W/System.err(1213): at java.net.Socket.connect(Socket.java:842)
03-12 09:51:36.410: W/System.err(1213): at libcore.net.http.HttpConnection.<init>(HttpConnection.java:76)
03-12 09:51:36.410: W/System.err(1213): at libcore.net.http.HttpConnection.<init>(HttpConnection.java:50)
03-12 09:51:36.410: W/System.err(1213): at libcore.net.http.HttpConnection$Address.connect(HttpConnection.java:340)
03-12 09:51:36.419: W/System.err(1213): at libcore.net.http.HttpConnectionPool.get(HttpConnectionPool.java:87)
03-12 09:51:36.419: W/System.err(1213): at libcore.net.http.HttpConnection.connect(HttpConnection.java:128)
03-12 09:51:36.430: W/System.err(1213): at libcore.net.http.HttpEngine.openSocketConnection(HttpEngine.java:316)
03-12 09:51:36.430: W/System.err(1213): at libcore.net.http.HttpsURLConnectionImpl$HttpsEngine.makeSslConnection(HttpsURLConnectionImpl.java:461)
03-12 09:51:36.479: W/System.err(1213): at libcore.net.http.HttpsURLConnectionImpl$HttpsEngine.connect(HttpsURLConnectionImpl.java:442 )
03-12 09:51:36.489: W/System.err(1213): at libcore.net.http.HttpEngine.sendSocketRequest(HttpEngine.java:290)
03-12 09:51:36.489: W/System.err(1213): at libcore.net.http.HttpEngine.sendRequest(HttpEngine.java:240)
03-12 09:51:36.489: W/System.err(1213): at libcore.net.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:81)
03-12 09:51:36.509: W/System.err(1213): at libcore.net.http.HttpsURLConnectionImpl.connect(HttpsURLConnectionImpl.java:165)
03-12 09:51:36.509: W/System.err(1213): at com.google.api.client.http.javanet.NetHttpRequest.execute(NetHttpRequest.java:90)
03-12 09:51:36.520: W/System.err(1213): at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:895)
03-12 09:51:36.530: W/System.err(1213): at com.androidhive.googleplacesandmaps.GooglePlaces.search(GooglePlaces.java:63)
03-12 09:51:36.530: W/System.err(1213): at com.androidhive.googleplacesandmaps.MainActivity$LoadPlaces.doInBackground(MainActivity.java:183)
03-12 09:51:36.530: W/System.err(1213): at com.androidhive.googleplacesandmaps.MainActivity$LoadPlaces.doInBackground(MainActivity.java:1)
03-12 09:51:36.582: W/System.err(1213): at android.os.AsyncTask$2.call(AsyncTask.java:287)
03-12 09:51:36.589: W/System.err(1213): at java.util.concurrent.FutureTask.run(FutureTask.java:234)
03-12 09:51:36.589: W/System.err(1213): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
03-12 09:51:36.599: W/System.err(1213): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
03-12 09:51:36.609: W/System.err(1213): at java.lang.Thread.run(Thread.java:856)
03-12 09:51:36.620: D/AndroidRuntime(1213): Shutting down VM
03-12 09:51:36.620: W/dalvikvm(1213): threadid=1: thread exiting with uncaught exception (group=0x40a71930)
03-12 09:51:36.649: E/AndroidRuntime(1213): FATAL EXCEPTION: main
03-12 09:51:36.649: E/AndroidRuntime(1213): java.lang.NullPointerException
03-12 09:51:36.649: E/AndroidRuntime(1213): at com.androidhive.googleplacesandmaps.MainActivity$LoadPlaces$1.run(MainActivity.java:209)
03-12 09:51:36.649: E/AndroidRuntime(1213): at android.app.Activity.runOnUiThread(Activity.java:4644)
03-12 09:51:36.649: E/AndroidRuntime(1213): at com.androidhive.googleplacesandmaps.MainActivity$LoadPlaces.onPostExecute(MainActivity.java:203)
03-12 09:51:36.649: E/AndroidRuntime(1213): at com.androidhive.googleplacesandmaps.MainActivity$LoadPlaces.onPostExecute(MainActivity.java:1)
03-12 09:51:36.649: E/AndroidRuntime(1213): at android.os.AsyncTask.finish(AsyncTask.java:631)
03-12 09:51:36.649: E/AndroidRuntime(1213): at android.os.AsyncTask.access$600(AsyncTask.java:177)
03-12 09:51:36.649: E/AndroidRuntime(1213): at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:644)
03-12 09:51:36.649: E/AndroidRuntime(1213): at android.os.Handler.dispatchMessage(Handler.java:99)
03-12 09:51:36.649: E/AndroidRuntime(1213): at android.os.Looper.loop(Looper.java:137)
03-12 09:51:36.649: E/AndroidRuntime(1213): at android.app.ActivityThread.main(ActivityThread.java:5041)
03-12 09:51:36.649: E/AndroidRuntime(1213): at java.lang.reflect.Method.invokeNative(Native Method)
03-12 09:51:36.649: E/AndroidRuntime(1213): at java.lang.reflect.Method.invoke(Method.java:511)
03-12 09:51:36.649: E/AndroidRuntime(1213): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
03-12 09:51:36.649: E/AndroidRuntime(1213): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
03-12 09:51:36.649: E/AndroidRuntime(1213): at dalvik.system.NativeStart.main(Native Method)
03-12 09:56:36.880: I/Process(1213): Sending signal. PID: 1213 SIG: 9

我已经用谷歌搜索了,但没有找到任何有用的解决方案。我尝试增加连接超时,但没有成功。

真的不知道是什么导致了问题,因为企业的 wifi 工作正常,但对于这个网站:maps.googleapis.com

最佳答案

因为我在代理后面工作,所以我已经完成了这些步骤,之后我没有收到这个错误:

  1. 要知道我落后的是哪个代理,我使用了这篇文章 https://superuser.com/questions/346372/how-do-i-know-what-proxy-server-im-using

  2. 在模拟器中,我转到“无线和网络设置”-->“移动网络”-->“访问点名称,并使用我在 wpad.dat 文件中找到的端口设置代理名称

  3. On Run Configuration> Android Application > App > Target > Additional Emulator Command Line Options: -http-proxy http://:

希望对大家有所帮助!

关于java - 连接到 maps.googleapis.com 的 Android TimeoutException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15361965/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com