Can't create a directory on /storage/emulated/0 on emulator

前端 未结 2 1269
余生分开走
余生分开走 2020-12-20 15:09

I\'m trying to create a directory on my android emulator but I can\'t do it, I already have the permission on manifest write_storage, and I get no erros but mkdir() return f

相关标签:
2条回答
  • 2020-12-20 15:45

    I had a similar issue was fixed by using mkdirs instead of mkdir

    0 讨论(0)
  • 2020-12-20 15:54

    You have to options:

    • Downgrade your compileSdkVersion and targetSdkVersion to lower version in your build.gradle
    • Request write permission at runtime is required on Android 6 .

    I personally don't advice the first one. For more info check:

    • Android 6.0 Marshmallow. Cannot write to SD Card
    • Google Play services 8.1 and Android 6.0 Permissions

    Hope this helps!!

    0 讨论(0)
提交回复
热议问题