1
resposta

Erro de Time out

O aplicativo da agenda não exibe a lista que está no servidor, e quando faco inserções ou alterações pelo aplicativo ele insere somente no aplicativo e recebe time ou quando vai acessar o servidor. segue log abaixo:

07-24 22:03:13.444 2653-7236/br.com.alura.agenda D/OkHttp: {"caminhoFoto":"/storage/emulated/0/Android/data/br.com.alura.agenda/files/Pictures/JPEG_20170724_220306_1774942816.jpg","endereco":"Rua do aluno","id":"8bd8c394-113f-4159-83a5-b3a371f26011","nome":"Novo Aluno","nota":10.0,"site":"sitedoaluno.com.br","telefone":"88888888"}
07-24 22:03:13.444 2653-7236/br.com.alura.agenda D/OkHttp: --> END POST (273-byte body)
07-24 22:03:13.472 1249-1306/? D/gralloc_ranchu: gralloc_alloc: format 1 and usage 0x900 imply creation of host color buffer
07-24 22:03:13.474 1249-1306/? D/gralloc_ranchu: gralloc_alloc: format 1 and usage 0x900 imply creation of host color buffer
07-24 22:03:13.476 1249-1306/? D/gralloc_ranchu: gralloc_alloc: format 1 and usage 0x900 imply creation of host color buffer
07-24 22:03:13.483 2653-2860/br.com.alura.agenda E/EGL_emulation: tid 2860: eglSurfaceAttrib(1146): error 0x3009 (EGL_BAD_MATCH)
07-24 22:03:13.483 2653-2860/br.com.alura.agenda W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0x91270dc0, error=EGL_BAD_MATCH
07-24 22:03:13.499 2653-2653/br.com.alura.agenda I/id do aluno: 8bd8c394-113f-4159-83a5-b3a371f26011
07-24 22:03:13.499 2653-7237/br.com.alura.agenda D/OkHttp: --> GET http://192.168.0.6:8080/api/aluno http/1.1
07-24 22:03:13.499 2653-7237/br.com.alura.agenda D/OkHttp: --> END GET
07-24 22:03:13.525 1249-1306/? D/gralloc_ranchu: gralloc_alloc: format 1 and usage 0x900 imply creation of host color buffer
07-24 22:03:13.540 1249-1306/? D/gralloc_ranchu: gralloc_alloc: format 1 and usage 0x900 imply creation of host color buffer
07-24 22:03:13.552 1249-1306/? D/gralloc_ranchu: gralloc_alloc: format 1 and usage 0x900 imply creation of host color buffer
07-24 22:03:13.567 2653-2860/br.com.alura.agenda E/EGL_emulation: tid 2860: eglSurfaceAttrib(1146): error 0x3009 (EGL_BAD_MATCH)
07-24 22:03:13.567 2653-2860/br.com.alura.agenda W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0x91270b00, error=EGL_BAD_MATCH
07-24 22:03:13.667 2653-2653/br.com.alura.agenda W/IInputConnectionWrapper: finishComposingText on inactive InputConnection
07-24 22:03:13.689 2653-2860/br.com.alura.agenda D/OpenGLRenderer: endAllActiveAnimators on 0x90f10900 (RippleDrawable) with handle 0xa287f500
07-24 22:03:13.959 1579-2074/system_process I/WindowManager: Destroying surface Surface(name=br.com.alura.agenda/br.com.alura.agenda.FormularioActivity) called by com.android.server.wm.WindowStateAnimator.destroySurface:2014 com.android.server.wm.WindowStateAnimator.destroySurfaceLocked:881 com.android.server.wm.WindowState.removeLocked:1449 com.android.server.wm.WindowManagerService.removeWindowInnerLocked:2478 com.android.server.wm.WindowManagerService.removeWindowLocked:2436 com.android.server.wm.WindowManagerService.removeWindowLocked:2305 com.android.server.wm.WindowManagerService.removeWindow:2300 com.android.server.wm.Session.remove:193 
07-24 22:03:15.951 1579-1606/system_process I/WindowManager: Destroying surface Surface(name=Toast) called by com.android.server.wm.WindowStateAnimator.destroySurface:2014 com.android.server.wm.WindowStateAnimator.destroySurfaceLocked:881 com.android.server.wm.WindowState.destroyOrSaveSurface:2073 com.android.server.wm.WindowSurfacePlacer.performSurfacePlacementInner:429 com.android.server.wm.WindowSurfacePlacer.performSurfacePlacementLoop:232 com.android.server.wm.WindowSurfacePlacer.performSurfacePlacement:180 com.android.server.wm.WindowManagerService$H.handleMessage:8079 android.os.Handler.dispatchMessage:102 
07-24 22:03:23.459 2653-7236/br.com.alura.agenda D/OkHttp: <-- HTTP FAILED: java.net.SocketTimeoutException: connect timed out
07-24 22:03:23.460 2653-2653/br.com.alura.agenda E/onFailure: Requisição falhou
07-24 22:03:23.522 2653-7237/br.com.alura.agenda D/OkHttp: <-- HTTP FAILED: java.net.SocketTimeoutException: connect timed out
07-24 22:03:23.523 2653-2653/br.com.alura.agenda E/onFailute chamado: connect timed out
1 resposta

Oi Victor, blz?

A tentativa que foi feita é no emulador ou celular físico? Pois esse tipo de erro indica que a requisiçãi está sendo feita, porém, não está conseguindo conectar, geralmente, o principal motivo é que o dispositivo não está realmente conectado na mesma rede da aplicação, ou o IP do computador mudou por ter desconectado da rede e entrado em outra.

Uma alternativa pra verificar se o dispositivo está na mesma rede que o servidor é acessando a url http://192.168.0.6:8080/ no navegador do dispositivo, seja emulador ou celular real, veja se funciona.

[]s