Can't create folder on external storage on android

后端 未结 8 1014
独厮守ぢ
独厮守ぢ 2020-12-05 11:25

My development phone is a Nexus 5, running Android 4.4.2.

In my application, I am attempting to create a folder on external storage that wi

相关标签:
8条回答
  • 2020-12-05 12:13

    First, new File() is just create object for file connect.
    you want use this file, file is exists or createNewFile().
    If you want use this file to create directory, check file is exists, isDirectory() after then mkDir().
    Second, check Environment.getExternalStorageDirectory is variable path.
    You can use DDMS or ADB for work.
    Additionaly, I think you add permission for read external storage for something error.

    0 讨论(0)
  • 2020-12-05 12:22

    For Android 10+ add following into manifest:

    <application
        android:requestLegacyExternalStorage="true"
        ...
    

    as asking for Manifest.permission.WRITE_EXTERNAL_STORAGE is no more enough.

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