一、导入控件
我使用的是 xutils2.6.14,导入方法如下,下载 xutils2.6.14(下载地址:)到目录libs下
在app文件夹下的 build.gradle 文件添加如下依赖项:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:25.3.1'
# 关键是这个
compile files('libs/xUtils-2.6.14.jar')
compile 'com.google.android.gms:play-services-appindexing:8.1.0'
}
至此,再将页面切换到对应的java文件,此时会弹出是术 “sync now” 点中即可
二、网络请求示例
直接上代码