Jamal
Jamal

Reputation: 976

Access a file from File Manager in Android 4.4 shows Exception

I am developing an android application,in this app I am accessing a file from android's default file manger.If I run this app in lower versions(Except Android 4.4) I can access file into my application but if I runned my app with android 4.4 kitkat OS I couldn't access a file from file manager it showed some Exceptions. here I attached my LogCat output.

LogCat

06-03 15:59:34.127 W/System.err(14882): java.io.FileNotFoundException: /system/etc/vold.fstab: open failed: ENOENT (No such file or directory)
06-03 15:59:34.127 W/System.err(14882):     at libcore.io.IoBridge.open(IoBridge.java:409)
06-03 15:59:34.127 W/System.err(14882):     at java.io.FileInputStream.<init>(FileInputStream.java:78)
06-03 15:59:34.127 W/System.err(14882):     at java.util.Scanner.<init>(Scanner.java:158)
06-03 15:59:34.127 W/System.err(14882):     at java.util.Scanner.<init>(Scanner.java:138)
06-03 15:59:34.127 W/System.err(14882):     at com.ipaulpro.afilechooser.StorageOptions.readVoldFile(StorageOptions.java:81)
06-03 15:59:34.127 W/System.err(14882):     at com.ipaulpro.afilechooser.StorageOptions.determineStorageOptions(StorageOptions.java:21)
06-03 15:59:34.127 W/System.err(14882):     at com.ipaulpro.afilechooser.FileChooserActivity.onCreate(FileChooserActivity.java:348)
06-03 15:59:34.127 W/System.err(14882):     at com.wepanow.MyFileChooserActivity.onCreate(MyFileChooserActivity.java:24)
06-03 15:59:34.127 W/System.err(14882):     at android.app.Activity.performCreate(Activity.java:5231)
06-03 15:59:34.127 W/System.err(14882):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
06-03 15:59:34.127 W/System.err(14882):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
06-03 15:59:34.127 W/System.err(14882):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
06-03 15:59:34.127 W/System.err(14882):     at android.app.ActivityThread.access$800(ActivityThread.java:135)
06-03 15:59:34.127 W/System.err(14882):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
06-03 15:59:34.127 W/System.err(14882):     at android.os.Handler.dispatchMessage(Handler.java:102)
06-03 15:59:34.127 W/System.err(14882):     at android.os.Looper.loop(Looper.java:136)
06-03 15:59:34.127 W/System.err(14882):     at android.app.ActivityThread.main(ActivityThread.java:5017)
06-03 15:59:34.127 W/System.err(14882):     at java.lang.reflect.Method.invokeNative(Native Method)
06-03 15:59:34.127 W/System.err(14882):     at java.lang.reflect.Method.invoke(Method.java:515)
06-03 15:59:34.127 W/System.err(14882):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
06-03 15:59:34.127 W/System.err(14882):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
06-03 15:59:34.127 W/System.err(14882):     at dalvik.system.NativeStart.main(Native Method)
06-03 15:59:34.127 W/System.err(14882): Caused by: libcore.io.ErrnoException: open failed: ENOENT (No such file or directory)
06-03 15:59:34.127 W/System.err(14882):     at libcore.io.Posix.open(Native Method)
06-03 15:59:34.127 W/System.err(14882):     at libcore.io.BlockGuardOs.open(BlockGuardOs.java:110)
06-03 15:59:34.127 W/System.err(14882):     at libcore.io.IoBridge.open(IoBridge.java:393)
06-03 15:59:34.127 W/System.err(14882):     ... 21 more



06-03 15:59:39.012 E/wepa    (14882): File select error
06-03 15:59:39.012 E/wepa    (14882): java.lang.NullPointerException
06-03 15:59:39.012 E/wepa    (14882):   at java.io.File.fixSlashes(File.java:185)
06-03 15:59:39.012 E/wepa    (14882):   at java.io.File.<init>(File.java:134)
06-03 15:59:39.012 E/wepa    (14882):   at com.ipaulpro.afilechooser.FileChooserActivity.onActivityResult(FileChooserActivity.java:453)
06-03 15:59:39.012 E/wepa    (14882):   at android.app.Activity.dispatchActivityResult(Activity.java:5423)
06-03 15:59:39.012 E/wepa    (14882):   at android.app.ActivityThread.deliverResults(ActivityThread.java:3361)
06-03 15:59:39.012 E/wepa    (14882):   at android.app.ActivityThread.handleSendResult(ActivityThread.java:3408)
06-03 15:59:39.012 E/wepa    (14882):   at android.app.ActivityThread.access$1300(ActivityThread.java:135)
06-03 15:59:39.012 E/wepa    (14882):   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1244)
06-03 15:59:39.012 E/wepa    (14882):   at android.os.Handler.dispatchMessage(Handler.java:102)
06-03 15:59:39.012 E/wepa    (14882):   at android.os.Looper.loop(Looper.java:136)
06-03 15:59:39.012 E/wepa    (14882):   at android.app.ActivityThread.main(ActivityThread.java:5017)
06-03 15:59:39.012 E/wepa    (14882):   at java.lang.reflect.Method.invokeNative(Native Method)
06-03 15:59:39.012 E/wepa    (14882):   at java.lang.reflect.Method.invoke(Method.java:515)
06-03 15:59:39.012 E/wepa    (14882):   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
06-03 15:59:39.012 E/wepa    (14882):   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
06-03 15:59:39.012 E/wepa    (14882):   at dalvik.system.NativeStart.main(Native Method)
06-03 15:59:39.012 D/ChooserActivity(14882): Intent Action: null
06-03 15:59:39.012 I/wepa    (14882): FileChooser > onResume
06-03 15:59:39.012 I/wepa    (14882): FC (onResume)has Extra:false
06-03 15:59:39.012 I/wepa    (14882): FC (onResume)has Extra:false
06-03 15:59:39.022 V/PhoneStatusBar(660): setLightsOn(true)
06-03 15:59:43.826 D/wepa    (14882): File selections canceled

Upvotes: 1

Views: 1633

Answers (1)

CommonsWare
CommonsWare

Reputation: 1006674

I am accessing a file from android's default file manger

Android does not have a file manager.

if I runned my app with android 4.4 kitkat OS I couldn't access a file from file manager it showed some Exceptions

You do not have read access to /system/etc/vold.fstab on this device, apparently. There is no requirement that this file be readable on all devices by ordinary SDK apps, and Android 4.4.x has been progressively tightening the security on access to the filesystem.

Upvotes: 2

Related Questions