学习Android的一些记录
-
文件上传
-
文件下载
-
Dialog
函数名 | 说明 |
---|---|
String.toast | 显示吐司 |
Any.log | DEBUG下打印日志 |
Date.format | 日期格式化 |
String.md5 | MD5加密 |
String.sha1 | sha1加密 |
String.sha256 | sha256加密 |
RequestConvertUtil.kt 获取网络请求签名的参数工具,使用Url.kt
// 添加kotlin注解插件
apply plugin: 'kotlin-kapt'
android{
// 配置JDK1.8
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies{
// 依赖我们的库
implementation project(path: ':funlib')
//注解处理器,生成RxHttp类
annotationProcessor 'com.rxjava.rxhttp:rxhttp-compiler:1.2.1'
kapt 'com.rxjava.rxhttp:rxhttp-compiler:1.2.1'
}
allprojects{
maven { url 'https://jitpack.io' }
}
3. Application 初始化网络请求 MyApp
4. 混淆文件
5. 创建Url类,用于rebuild,RxHttp类,Url
res/xml下:file_paths
-
添加相应权限
-
application节点下
- android:networkSecurityConfig="@xml/network_config"
- android:name=".MyApp"
-
兼容 Android 7.0
<provider android:name="androidx.core.content.FileProvider" android:authorities="包名.fileprovider" android:exported="false" android:grantUriPermissions="true"> <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/file_paths" /> </provider>