当前位置: 移动技术网 > IT编程>开发语言>Java > Android问题笔记

Android问题笔记

2020年08月10日  | 移动技术网IT编程  | 我要评论
1 Post请求失败ErrorW/System.err: java.net.SocketException: socket failed: EACCES (Permission denied)Reason权限不够在文件清单中添加uses-permissionPlan<?xml version="1.0" encoding="utf-8"?><manife...

1 Post请求失败

  • 异常
    W/System.err: java.net.SocketException: socket failed: EACCES (Permission denied)

  • 原因
    权限不够
    在文件清单中添加uses-permission

  • 方案

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

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher">
        <activity android:name=".MainActivity">
        </activity>
    </application>
    <uses-permission android:name="android.permission.INTERNET"/>
</manifest>

2 Gradle下载失败

  • 场景
    首次使用Android Studio新建Andorid项目,Gradle下载相关组件时过慢或失败
  • 方案
    添加下载源,修改第一层文件夹下的build.gradle文件,添加maven{url ‘http://maven.aliyun.com/nexus/content/groups/public/’},完整问文件如下:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    repositories {
        maven{url 'http://maven.aliyun.com/nexus/content/groups/public/'}
        google()
        jcenter()
    }
    dependencies {
        classpath "com.android.tools.build:gradle:4.0.1"

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        maven{url 'http://maven.aliyun.com/nexus/content/groups/public/'}
        google()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

本文地址:https://blog.csdn.net/Xin_101/article/details/100661674

如您对本文有疑问或者有任何想说的,请点击进行留言回复,万千网友为您解惑!

相关文章:

验证码:
移动技术网