java - Why can I write to "mnt/sdcard" and not to "mnt/extsd"? -


i'm trying store file external storage (android 4.2.2).

i'm using correct permission in manifest.xml:

<manifest ...>    ...    <uses-permission android:name="android.permission.write_external_storage" />    <uses-permission android:name="android.permission.read_external_storage"/>    ... 

the external sd card available, can prove using other app read , write files. path /mnt/extsd/ valid, @ picture below. external sd card writable because can copy/paste files it.

enter image description here

the code:

try {     string path = "/mnt/extsd/file.dat"     file f = new file(path);     f.createnewfile();     return true; } catch (exception e) {     e.printstacktrace();     return false; } 

i error on f.createnewfile();:

w/system.err(2172): java.io.ioexception: open failed: eacces (permission denied) w/system.err(2172):     @ java.io.file.createnewfile(file.java:948) w/system.err(2172):     @ solarapp.activities.settings.application.activitybackup$backuptask.doinbackground(activitybackup.java:77) w/system.err(2172):     @ solarapp.activities.settings.application.activitybackup$backuptask.doinbackground(activitybackup.java:1) w/system.err(2172):     @ android.os.asynctask$2.call(asynctask.java:287) w/system.err(2172):     @ java.util.concurrent.futuretask.run(futuretask.java:234) w/system.err(2172):     @ android.os.asynctask$serialexecutor$1.run(asynctask.java:230) w/system.err(2172):     @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1080) w/system.err(2172):     @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:573) w/system.err(2172):     @ java.lang.thread.run(thread.java:856) w/system.err(2172): caused by: libcore.io.errnoexception: open failed: eacces (permission denied) w/system.err(2172):     @ libcore.io.posix.open(native method) w/system.err(2172):     @ libcore.io.blockguardos.open(blockguardos.java:110) w/system.err(2172):     @ java.io.file.createnewfile(file.java:941) 

if use string path = "/mnt/extsd/file.dat" everything works fine! so, problem?

edit

i'm using solution available storage list:

how can list of mounted external storage of android device

and, suggested, post result of command adb shell cat /proc/mounts:

rootfs / rootfs rw 0 0 tmpfs /dev tmpfs rw,nosuid,relatime,mode=755 0 0 devpts /dev/pts devpts rw,relatime,mode=600 0 0 proc /proc proc rw,relatime 0 0 sysfs /sys sysfs rw,relatime 0 0 none /acct cgroup rw,relatime,cpuacct 0 0 tmpfs /mnt/secure tmpfs rw,relatime,mode=700 0 0 tmpfs /mnt/asec tmpfs rw,relatime,mode=755,gid=1000 0 0 tmpfs /mnt/obb tmpfs rw,relatime,mode=755,gid=1000 0 0 none /dev/cpuctl cgroup rw,relatime,cpu 0 0 debugfs /sys/kernel/debug debugfs rw,relatime 0 0 /dev/block/by-name/system /system ext4 ro,relatime,data=ordered 0 0 /dev/block/by-name/cache /cache ext4 rw,nosuid,nodev,noatime,nomblk_io_submit,data=ordered 0 0 /dev/block/by-name/data /data ext4 rw,nosuid,nodev,noatime,nomblk_io_submit,noauto_da_alloc,data=ordered 0 0  /dev/block/vold/93:72 /mnt/sdcard vfat rw,dirsync,nosuid,nodev,noexec,relatime,uid=1000,gid=1015,fmask=0702,dmask=0702,allow_utime=0020,codepage=cp437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro 0 0  /dev/block/vold/93:72 /mnt/secure/asec vfat rw,dirsync,nosuid,nodev,noexec,relatime,uid=1000,gid=1015,fmask=0702,dmask=0702,allow_utime=0020,codepage=cp437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro 0 0  tmpfs /mnt/sdcard/.android_secure tmpfs ro,relatime,size=0k,mode=000 0 0  /dev/block/vold/179:1 /mnt/extsd vfat rw,dirsync,nosuid,nodev,noexec,relatime,uid=1000,gid=1023,fmask=0702,dmask=0702,allow_utime=0020,codepage=cp437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro 0 0 

response command adb shell cat /proc/partitions

 major  minor    #blocks name   93        0      32768 nanda   93        8      16384 nandb   93       16      16384 nandc   93       24     786432 nandd   93       32    1048576 nande   93       40      16384 nandf   93       48      32768 nandg   93       56     524288 nandh   93       64     131072 nandi   93       72    4409344 nandj  179        0    3849216 mmcblk0  179        1    3845120 mmcblk0p1 

response command adb shell cat /proc/devices , adb shell ls -l /mnt

character devices:   1 mem   4 /dev/vc/0   4 tty   5 /dev/tty   5 /dev/console   5 /dev/ptmx   7 vcs  10 misc  13 input  29 fb  81 video4linux 100 telephony 108 ppp 116 alsa 128 ptm 136 pts 150 cedar_dev 166 ttyacm 180 usb 188 ttyusb 189 usb_device 216 rfcomm 247 lcd 248 capture 249 disp 250 ttygs 251 ttys 252 sunxi_pwm 253 bsg 254 rtc  block devices: 259 blkext   7 loop   8 sd  65 sd  66 sd  67 sd  68 sd  69 sd  70 sd  71 sd  93 nand 128 sd 129 sd 130 sd 131 sd 132 sd 133 sd 134 sd 135 sd 179 mmc 254 device-mapper /system/bin/sh: cat: and: no such file or directory /system/bin/sh: cat: adb: no such file or directory /system/bin/sh: cat: shell: no such file or directory /system/bin/sh: cat: ls: no such file or directory /system/bin/sh: cat: -l: no such file or directory /system/bin/sh: cat: /mnt: directory 

response command adb shell ls -l /mnt

drwxr-xr-x root     system            2014-04-22 11:56 asec d---rwxr-x system   media_rw          1970-01-01 01:00 extsd drwxrwx--- media_rw media_rw          2014-04-22 11:56 media drwxr-xr-x root     system            2014-04-22 11:56 obb d---rwxr-x system   sdcard_rw          2014-04-22 12:26 sdcard drwx------ root     root              2014-04-22 11:56 secure drwx------ shell    shell             2014-04-22 11:56 shell d--------- system   system            2014-04-22 11:56 usbhost1 

response command adb shell ls -l /mnt   d---rwxr-x system   media_rw          1970-01-01 01:00 extsd 

to write extsd process need part of group media_rw write_external_storage add sdcard_rw group. permission need write_media_storage but, unfortunately, protection level signatureorsystem , can not use in app


Comments

Popular posts from this blog

java - Intellij Synchronizing output directories .. -

git - Initial Commit: "fatal: could not create leading directories of ..." -