专栏首页一个会写诗的程序员的博客java.lang.SecurityException: Permission denied (missing INTERNET permission?)

java.lang.SecurityException: Permission denied (missing INTERNET permission?)

E/AndroidRuntime: FATAL EXCEPTION: Thread-4 Process: com.easy.kotlin, PID: 5384 java.lang.SecurityException: Permission denied (missing INTERNET permission?) at java.net.Inet6AddressImpl.lookupHostByName(Inet6AddressImpl.java:135) at java.net.Inet6AddressImpl.lookupAllHostAddr(Inet6AddressImpl.java:90) at java.net.InetAddress.getAllByName(InetAddress.java:787) at com.android.okhttp.Dns$1.lookup(Dns.java:39) at com.android.okhttp.internal.http.RouteSelector.resetNextInetSocketAddress(RouteSelector.java:175) at com.android.okhttp.internal.http.RouteSelector.nextProxy(RouteSelector.java:141) at com.android.okhttp.internal.http.RouteSelector.next(RouteSelector.java:83) at com.android.okhttp.internal.http.StreamAllocation.findConnection(StreamAllocation.java:174) at com.android.okhttp.internal.http.StreamAllocation.findHealthyConnection(StreamAllocation.java:126) at com.android.okhttp.internal.http.StreamAllocation.newStream(StreamAllocation.java:95) at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:281) at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:224) at com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:461) at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:407) at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:244) at java.net.URL.openStream(URL.java:1058) at kotlin.io.TextStreamsKt.readBytes(ReadWrite.kt:144) at com.easy.kotlin.bean.MovieContent$initMovieListData$1.run(MovieContent.kt:22) at java.lang.Thread.run(Thread.java:764) Caused by: android.system.GaiException: android_getaddrinfo failed: EAI_NODATA (No address associated with hostname) at libcore.io.Linux.android_getaddrinfo(Native Method) at libcore.io.ForwardingOs.android_getaddrinfo(ForwardingOs.java:58) at java.net.Inet6AddressImpl.lookupHostByName(Inet6AddressImpl.java:122) at java.net.Inet6AddressImpl.lookupAllHostAddr(Inet6AddressImpl.java:90) at java.net.InetAddress.getAllByName(InetAddress.java:787) at com.android.okhttp.Dns$1.lookup(Dns.java:39) at com.android.okhttp.internal.http.RouteSelector.resetNextInetSocketAddress(RouteSelector.java:175) at com.android.okhttp.internal.http.RouteSelector.nextProxy(RouteSelector.java:141) at com.android.okhttp.internal.http.RouteSelector.next(RouteSelector.java:83) at com.android.okhttp.internal.http.StreamAllocation.findConnection(StreamAllocation.java:174) at com.android.okhttp.internal.http.StreamAllocation.findHealthyConnection(StreamAllocation.java:126) at com.android.okhttp.internal.http.StreamAllocation.newStream(StreamAllocation.java:95) at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:281) at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:224) at com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:461) at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:407) at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:244) at java.net.URL.openStream(URL.java:1058) at kotlin.io.TextStreamsKt.readBytes(ReadWrite.kt:144) at com.easy.kotlin.bean.MovieContent$initMovieListData$1.run(MovieContent.kt:22) at java.lang.Thread.run(Thread.java:764) Caused by: android.system.ErrnoException: android_getaddrinfo failed: EACCES (Permission denied) at libcore.io.Linux.android_getaddrinfo(Native Method) at libcore.io.ForwardingOs.android_getaddrinfo(ForwardingOs.java:58) at java.net.Inet6AddressImpl.lookupHostByName(Inet6AddressImpl.java:122) at java.net.Inet6AddressImpl.lookupAllHostAddr(Inet6AddressImpl.java:90) at java.net.InetAddress.getAllByName(InetAddress.java:787) at com.android.okhttp.Dns$1.lookup(Dns.java:39) at com.android.okhttp.internal.http.RouteSelector.resetNextInetSocketAddress(RouteSelector.java:175) at com.android.okhttp.internal.http.RouteSelector.nextProxy(RouteSelector.java:141) at com.android.okhttp.internal.http.RouteSelector.next(RouteSelector.java:83) at com.android.okhttp.internal.http.StreamAllocation.findConnection(StreamAllocation.java:174) at com.android.okhttp.internal.http.StreamAllocation.findHealthyConnection(StreamAllocation.java:126) at com.android.okhttp.internal.http.StreamAllocation.newStream(StreamAllocation.java:95) at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:281) at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:224) at com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:461) at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:407) at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:244) at java.net.URL.openStream(URL.java:1058) at kotlin.io.TextStreamsKt.readBytes(ReadWrite.kt:144) at com.easy.kotlin.bean.MovieContent$initMovieListData$1.run(MovieContent.kt:22) at java.lang.Thread.run(Thread.java:764)


加上配置: <uses-permission android:name="android.permission.INTERNET" />

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.easy.kotlin">

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity
            android:name=".ItemListActivity"
            android:label="@string/app_name"
            android:theme="@style/AppTheme.NoActionBar">
            <!--<intent-filter>-->
            <!--<action android:name="android.intent.action.MAIN" />-->
            <!--<category android:name="android.intent.category.LAUNCHER" />-->
            <!--</intent-filter>-->
        </activity>
        <activity
            android:name=".ItemDetailActivity"
            android:label="@string/title_item_detail"
            android:parentActivityName=".ItemListActivity"
            android:theme="@style/AppTheme.NoActionBar">
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value="com.easy.kotlin.ItemListActivity" />
        </activity>


        <activity
            android:name=".MovieListActivity"
            android:label="@string/app_name"
            android:theme="@style/AppTheme.NoActionBar">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name=".MovieDetailActivity"
            android:label="@string/title_movie_detail"
            android:parentActivityName=".MovieListActivity"
            android:theme="@style/AppTheme.NoActionBar">
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value="com.easy.kotlin.MovieListActivity" />
        </activity>
    </application>

    <uses-permission android:name="android.permission.INTERNET" />

</manifest>

本文参与腾讯云自媒体分享计划,欢迎正在阅读的你也加入,一起分享。

我来说两句

0 条评论
登录 后参与评论

相关文章

  • 第14章 使用Kotlin 进行 Android 开发(2)

    我们使用 fastjson 来解析这个数据。在 app 下面的 build.gradle中添加依赖

    一个会写诗的程序员
  • java.base.jmod

    /Library/Java/JavaVirtualMachines/jdk-9.jdk/Contents/Home/jmods$ jmod list java....

    一个会写诗的程序员
  • 第14章 使用Kotlin 进行 Android 开发(1)第14章 使用Kotlin 进行 Android 开发(1)

    根据Realm Report (2017-Q4,https://realm.io/realm-report/2017-q4 ) ,过去的一年在Android ...

    一个会写诗的程序员
  • [异常特工]android常见bug跟踪

    前言 对app的线上bug的收集(友盟、云捕等)有时会得到这样的异常堆栈信息:没有一行代码是有关自身程序代码的。这使得对bug的解决无从下手,根据经验,内存不足...

    用户1172465
  • Android解决java.lang.NoSuchMethodError: No virtual method into报错问题过程

    最近项目中需要接入容联七陌客服系统,接入过程中将容联的Demo作为module添加到项目中,然后添加依赖,过程貌似很顺利,编译也没有问题,可是进入客服界面时,却...

    SoullessCoder
  • android 添加React Native支持更新版

    前言 之前已经写过了有关React Native移植原生Android项目的文章,不过因为RN版本更新的原因吧,跟着以前的文章可能会出现一些问题,对于初学者来讲...

    xiangzhihong
  • Android Gradle实用技巧(五) | 善用AndroidManifest占位符

    占位符,其实是一个可以被替换的临时标记,比如${name},我们就可以使用真实的name变量的值替换这个占位符,达到可以动态的修改这个占位符的目的。所以Andr...

    飞雪无情
  • [android] 利用广播实现ip拨号

    广播接收者,broadcast receiver,安卓系统在使用时会产生很多的事件,比如:短信到来,电量低,拨打电话等等

    陶士涵
  • 安卓开发_浅谈主配置文件(AndroidManifest.xml)

    听着music睡
  • 位置定位(LocationManager)

    LocationManager是Android 提供的Location 服务,来获得当前的位置信息和卫星信息。

    李小白是一只喵

扫码关注云+社区

领取腾讯云代金券