注:参考了别人的代码,来源不清楚,然后实践之后记录下来,防止忘记
1.导入包
//图片选择器
implementation 'com.github.donkingliang:ImageSelector:1.6.8'
implementation 'com.github.nanchen2251:CompressHelper:1.0.5'
//glide
implementation 'com.github.bumptech.glide:glide:3.7.0'
//retrofit
implementation 'com.squareup.retrofit2:converter-gson:2.0.2'
implementation 'com.squareup.retrofit2:retrofit:2.0.2'
implementation 'com.squareup.okhttp3:okhttp:3.4.1'
allprojects {
repositories {
google()
jcenter()
maven{url 'https://jitpack.io'}
}
}
manifest配置
<!-- 储存卡的读写权限 -->
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<!-- 调用相机权限 -->
<uses-permission android:name="android.permission.CAMERA" />
<activity
android:name="com.donkingliang.imageselector.ImageSelectorActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:theme