close

[Solved] Can’t create directory in Android 10

Hello Guys, How are you all? Hope You all Are Fine. Today I get the following error Can’t create directory in Android 10 in java. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How Can’t create directory in Android 10 Error Occurs?

Today I get the following error Can’t create directory in Android 10 in java.

How To Solve Can’t create directory in Android 10 Error ?

  1. How To Solve Can't create directory in Android 10 Error ?

    To Solve Can't create directory in Android 10 Error targeting api 28 (or lower) using requestLegacyExternalStorage manifest attribute:

  2. Can't create directory in Android 10

    To Solve Can't create directory in Android 10 Error targeting api 28 (or lower) using requestLegacyExternalStorage manifest attribute:

Solution 1

For Android 10, you can add

android:requestLegacyExternalStorage="true"

to your element in the manifest. This opts you into the legacy storage model, and your existing external storage code will work. This fix will not work on Android R and higher though, so this is only a short-term fix.

Solution 2

Since Q beta 4 it’s possible to opt-out of that feature by:

targeting api 28 (or lower) using requestLegacyExternalStorage manifest attribute:

<manifest ... >
  <!-- This attribute is "false" by default on apps targeting Android Q. -->
  <application android:requestLegacyExternalStorage="true" ... >
    ...
  </application>
</manifest>

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.

Also, Read

Leave a Comment