Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android11 报错java.lang.RuntimeException: Unable to start service com.zlw.main.recorderlib.recorder.RecordService@670d8aa with Intent { cmp=com.example.demo/com.zlw.main.recorderlib.recorder.RecordService (has extras) }: java.lang.NullPointerException #57

Open
MengYaoSai opened this issue Mar 12, 2021 · 0 comments

Comments

@MengYaoSai
Copy link

Android11 的分区存储导致的报错
创建文件夹使用 context.getExternalFilesDir(Environment.DIRECTORY_MUSIC).getAbsolutePath()方法获取文件路径

1、修改的moule 里面的 RecordService 的getFilePath方法
2、把moulel里面的String.format(Locale.getDefault(), "%s/Record/", Environment.getExternalStorageDirectory().getAbsolutePath()) 都换成context.getExternalFilesDir(Environment.DIRECTORY_MUSIC).getAbsolutePath()
然后就可以了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant