Ошибка при парсинге HTML страницы в Android

168
03 октября 2018, 03:10

Мне необходимо получить два значения конкретных значения с сайта, у каждого значения свой уникальный тег. Все это получается в программе для Windows, но при попытке повторить тоже самое на Android, приложение вылетает и говорит, что ошибка в этой строке:

Document document = Jsoup.connect("ссылка").get();

Не могу понять в чем заключается ошибка.

E/AndroidRuntime: F    ATAL EXCEPTION: Thread-402
Process: com.example.gekab.directtask, PID: 8843
java.lang.SecurityException: Permission denied (missing INTERNET permission?)
at java.net.InetAddress.lookupHostByName(InetAddress.java:464)
at java.net.InetAddress.getAllByNameImpl(InetAddress.java:252)
at java.net.InetAddress.getAllByName(InetAddress.java:215)
at com.android.okhttp.internal.Network$1.resolveInetAddresses(Network.java:29)
at om.android.okhttp.internal.http.RouteSelector.resetNextInetSocketAddress(RouteSelector.java:188)
at com.android.okhttp.internal.http.RouteSelector.nextProxy(RouteSelector.java:157)
at com.android.okhttp.internal.http.RouteSelector.next(RouteSelector.java:100)
at com.android.okhttp.internal.http.HttpEngine.cre    ateNextConnection(HttpEngine.java:357)
at com.android.okhttp.internal.http.HttpEngine.nextConnection(HttpEngine.java:340)
at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:330)
at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:248)
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:433)
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:114)
at org.jsoup.helper.HttpConnection$Response.execute(HttpConnection.java:746)
at org.jsoup.helper.HttpConnection$Response.execute(HttpConnection.java:722)
at org.jsoup.helper.HttpConnection.execute(HttpConnection.java:306)
at org.jsoup.helper.HttpConnection.get(HttpConnection.java:295)
at com.example.gekab.directtask.MainActivity$2.run(MainActivity.java:89)
at java.lang.Thread.run(Thread.java:818)
Caused by: android.system.GaiException: android_getaddrinfo failed: EAI_NOD    ATA (No address associated with hostname)
at libcore.io.Posix.android_getaddrinfo(N    ative Method)
at libcore.io.ForwardingOs.android_getaddrinfo(ForwardingOs.java:55)
at java.net.InetAddress.lookupHostByName(InetAddress.java:451)
at java.net.InetAddress.getAllByNameImpl(InetAddress.java:252) 
at java.net.InetAddress.getAllByName(InetAddress.java:215) 
at com.android.okhttp.internal.Network$1.resolveInetAddresses(Network.java:29) 
at om.android.okhttp.internal.http.RouteSelector.resetNextInetSocketAddress(RouteSelector.java:188) 
at com.android.okhttp.internal.http.RouteSelector.nextProxy(RouteSelector.java:157) 
at com.android.okhttp.internal.http.RouteSelector.next(RouteSelector.java:100) 
at com.android.okhttp.internal.http.HttpEngine.cre    ateNextConnection(HttpEngine.java:357) 
at com.android.okhttp.internal.http.HttpEngine.nextConnection(HttpEngine.java:340) 
at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:330) 
at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:248) 
at om.android.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:433) 
at om.android.okhttp.internal.huc.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:114) 
at org.jsoup.helper.HttpConnection$Response.execute(HttpConnection.java:746) 
at org.jsoup.helper.HttpConnection$Response.execute(HttpConnection.java:722) 
at org.jsoup.helper.HttpConnection.execute(HttpConnection.java:306) 
at org.jsoup.helper.HttpConnection.get(HttpConnection.java:295) 
at com.example.gekab.directtask.MainActivity$2.run(MainActivity.java:89) 
at java.lang.Thread.run(Thread.java:818) 
Caused by: android.system.ErrnoException: android_getaddrinfo failed: EACCES (Permission denied)
at libcore.io.Posix.android_getaddrinfo(N    ative Method) 
at libcore.io.ForwardingOs.android_getaddrinfo(ForwardingOs.java:55) 
at java.net.InetAddress.lookupHostByName(InetAddress.java:451) 
at java.net.InetAddress.getAllByNameImpl(InetAddress.java:252) 
at java.net.InetAddress.getAllByName(InetAddress.java:215) 
at com.android.okhttp.internal.Network$1.resolveInetAddresses(Network.java:29)    at com.android.okhttp.internal.http.RouteSelector.resetNextInetSocketAddress(RouteSelector.java:188) 
at com.android.okhttp.internal.http.RouteSelector.nextProxy(RouteSelector.java:157) 
at com.android.okhttp.internal.http.RouteSelector.next(RouteSelector.java:100) 
at com.android.okhttp.internal.http.HttpEngine.cre    ateNextConnection(HttpEngine.java:357)      at com.android.okhttp.internal.http.HttpEngine.nextConnection(HttpEngine.java:340)
  at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:330) 
at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:248)    at com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:433) 
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:114) 
at org.jsoup.helper.HttpConnection$Response.execute(HttpConnection.java:746) 
at org.jsoup.helper.HttpConnection$Response.execute(HttpConnection.java:722) 
at org.jsoup.helper.HttpConnection.execute(HttpConnection.java:306) 
at org.jsoup.helper.HttpConnection.get(HttpConnection.java:295) 
at com.example.gekab.directtask.MainActivity$2.run(MainActivity.java:89) 
at java.lang.Thread.run(Thread.java:818) 
D/EGL_emul    ation: eglMakeCurrent: 0xae4d4660: ver 3 1 (tinfo 0xae4d2e50)
E/Surface: getSlotFromBufferLocked: unknown buffer: 0xae649e60
D/OpenGLRenderer: endAllStagingAnim    ators on 0xaa059a00 (MenuPopupWindow$MenuDropDownListView) with handle 0xae631530
E/Surface: getSlotFromBufferLocked: unknown buffer: 0xae649820
READ ALSO
Как исправить Cannot find the declaration of element 'hibernate-configuration'

Как исправить Cannot find the declaration of element 'hibernate-configuration'

Начал смотреть что такое Hibernate и БД PostgreSQL, но столкнулся с проблемойIdea выкидывает следующее сообщение

207
Не подключаются драйверы:java.lang.IllegalStateException: The path to the driver executable must be set by the webdriver.chrome.driver system property

Не подключаются драйверы:java.lang.IllegalStateException: The path to the driver executable must be set by the webdriver.chrome.driver system property

Только начала осваивать автоматизацию тестирования, столкнулась с тем, что Intellij IDEA никак не может подключить geckodriver для Firefox и chromedriver для...

209
Как центрировать блок?

Как центрировать блок?

Добрый день изучаю верстку , и в примере в меню цена есть 3 блока с описанием цен и тдПроблема в том что он разложил эти блоки по grid колонкам...

175
Почему не изменяется scroll?

Почему не изменяется scroll?

Всем приветПри загрузке страницы, scroll должен сразу же сам изменять свое положение на 500px от top'a

198