Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-20470

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


    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: Release 5.2.0
    • Fix Version/s: Release 5.4.0
    • Component/s: Android
    • Labels:
    • Story Points:
    • Sprint:
      2016 Sprint 07 SDK


      Steps to Reproduce

      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.

      [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.<init>(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.

      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.

      Actual Result

      File does not exist in tempDirectory when permission is enabled on RunTime.

      Expected Result

      File should exist in tempDirectory.


          Issue Links



              • Assignee:
                hpham Hieu Pham
                echeung@leviton.com Eric Cheung
              • Watchers:
                1 Start watching this issue


                • Created:

                  Backbone Issue Sync

                  • Titanium SDK/CLI <> Titanium Mobile
                    Synced with:
                    Sync status:
                    Last received:
                    Last sent:

                    Git Integration