<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
动态权限是否申请
网上找的,说要在 清单文件里的 application 里面加上
android:requestLegacyExternalStorage="true"
4.1 缓存路径
BaseApplication.getContext().getCacheDir().getAbsolutePath()
4.2 非 0 路径
public static String getBaseFolder() {
String baseFolder = Environment.getExternalStorageDirectory() + "/record/";
File f = new File(baseFolder);
if (!f.exists()) {
boolean b = f.mkdirs();
if (!b) {
baseFolder = BaseApplication.Companion.getMContext().getExternalFilesDir(null).getAbsolutePath() + "/";
}
}
return baseFolder;
}