Hi, Having WRITE_EXTERNAL_STORAGE permissions granted, the external sdcard is writable in a real device but not in the emulator in Android Studio
File[] dirs = getExternalFilesDirs(null); File sdcard = dirs[1]; File sdcardRoot = sdcard.getParentFile().getParentFile().getParentFile(). getParentFile(); String w = (sdcardRoot.canWrite()) ? "is writable": "is NOT writable"; Log.v(TAG, "file: "+sdcardRoot.getAbsolutePath()+" "+w); Running in emulator Log says: file: /storage/42B6-1509 is NOT writable And in real device (motorola E 2nd gen): file: /storage/4233-16E2 is writable Both devices run Android 6.0 Why do permissions to write in SDcard differ here? Thanks -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. To post to this group, send email to android-developers@googlegroups.com. Visit this group at https://groups.google.com/group/android-developers. To view this discussion on the web visit https://groups.google.com/d/msgid/android-developers/0378c3f1-44a8-4d43-ae93-aec44f2f3313%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.