Titanium JIRA Archive
Appcelerator Community (AC)

[AC-682] Android 6.0 (Post 5.2.0 SDK): java.io.FileNotFoundException: open failed: ENOENT (No such file or directory)

GitHub Issuen/a
TypeBug
Priorityn/a
StatusClosed
ResolutionDuplicate
Resolution Date2016-02-29T09:35:58.000+0000
Affected Version/sAppcelerator Studio 4.4.0
Fix Version/sn/a
Componentsn/a
Labelsn/a
ReporterEric Cheung
AssigneeShak Hossain
Created2016-02-24T21:57:28.000+0000
Updated2016-02-29T09:35:58.000+0000

Description

I played around with the latest 5.2.0 SDK and Nexus 6P... for the most part everything seems to work except for one case with runtime permission. if I use Ti.Filesystem.tempDirectory as my storage and created the permission checks, this still fails on first try even if you accept the Permission. Log: {{[INFO] : Permission granted? true [ERROR] : TiFileProxy: (KrollRuntimeThread) [66154,66154] IOException encountered [ERROR] : TiFileProxy: java.io.FileNotFoundException: /storage/emulated/0/Android/data/com.apptest.tempdirperm/cache/_tmp/GettingStartedTitanium_Linux.pdf: open failed: ENOENT (No such file or directory) [ERROR] : TiFileProxy: at libcore.io.IoBridge.open(IoBridge.java:452) [ERROR] : TiFileProxy: at java.io.FileOutputStream.(FileOutputStream.java:87) [ERROR] : TiFileProxy: at org.appcelerator.titanium.io.TiFile.getOutputStream(TiFile.java:273) [ERROR] : TiFileProxy: at org.appcelerator.titanium.io.TiFile.open(TiFile.java:336) [ERROR] : TiFileProxy: at org.appcelerator.titanium.io.TiFile.write(TiFile.java:382) [ERROR] : TiFileProxy: at org.appcelerator.titanium.TiFileProxy.write(TiFileProxy.java:290) [ERROR] : TiFileProxy: at org.appcelerator.kroll.runtime.v8.V8Object.nativeCallProperty(Native Method) [ERROR] : TiFileProxy: at org.appcelerator.kroll.runtime.v8.V8Object.callProperty(V8Object.java:73) [ERROR] : TiFileProxy: at org.appcelerator.kroll.KrollProxy.handleMessage(KrollProxy.java:1155) [ERROR] : TiFileProxy: at android.os.Handler.dispatchMessage(Handler.java:98) [ERROR] : TiFileProxy: at android.os.Looper.loop(Looper.java:148) [ERROR] : TiFileProxy: at org.appcelerator.kroll.KrollRuntime$KrollRuntimeThread.run(KrollRuntime.java:118) [ERROR] : TiFileProxy: Caused by: android.system.ErrnoException: open failed: ENOENT (No such file or directory) [ERROR] : TiFileProxy: at libcore.io.Posix.open(Native Method) [ERROR] : TiFileProxy: at libcore.io.BlockGuardOs.open(BlockGuardOs.java:186) [ERROR] : TiFileProxy: at libcore.io.IoBridge.open(IoBridge.java:438) [ERROR] : TiFileProxy: ... 11 more [INFO] : ALERT: (KrollRuntimeThread) [41,66195] File exist? false}} Steps to recreate: * Create new Mobile App Project and paste in code to index.js * Compile and run, make sure it is a clean install on device * Click the "Hello, World" to trigger the download and permission. * Accept the permission on popup. * Accessing the file in temporary directory fails. (alert will say file does not exist) * Close the app * Check permission in settings > app permission (storage should be enabled) * Restart the app * Click "Hello, World" again to trigger download. * Alert will now say file exists. Workaround: If I switch the Ti.Filesystem.tempDirectory to Ti.Filesystem.applicationDataDirectory, I do not run into the issue of having to restart the app to open the file. But I have to make sure those files are deleted after use. It would be best to use temporary directory so that the files are automatically removed after app is closed.

Attachments

FileDateSize
index.js2016-02-24T21:55:43.000+0000981
Screenshot_20160224-165334.png2016-02-24T21:56:46.000+000086518
Screenshot_20160224-165342.png2016-02-24T21:56:46.000+000064817

Comments

  1. Eric Cheung 2016-02-24

    Please close this... made a duplicate of TC-5878. Sorry

JSON Source