What is wrong in the code? I can not create a folder in the sdcard. Permissions to read and write in the manifest are specified. There is no launch of the application, just the folder is not created either in the emulator or on the real device.

public class WelcomeActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_welcome); String folderB = "bookfiles_"+1; File bookfolder = new File(Environment.getExternalStorageDirectory(), folderB); if(!bookfolder.exists()){ bookfolder.mkdir(); Log.d("my", "dir. created"); } else { Log.d("my", "dir. already exists"); } } } 

Here is the error log:

 11-22 22:55:11.929 16566-16566/? E/Zygote: v2 11-22 22:55:11.930 16566-16566/? E/Zygote: accessInfo : 0 

    1 answer 1

    Figured out by yourself

      File bookfolder = new File(getExternalFilesDir(folderB), folderB);