Android问题笔记
程序员文章站
2022-06-19 13:03:18
1 Post请求失败ErrorW/System.err: java.net.SocketException: socket failed: EACCES (Permission denied)Reason权限不够在文件清单中添加uses-permissionPlan
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
上一篇: 树莓派开发—超声波测距
下一篇: flex复选框和下拉列表的几种用法整理