Project: titanium
Issue TIMOB-20251: Android 6.0: java.io.FileNotFoundException: open failed: ENOENT (No such file or directory)
h6.Issue Description While trying to write the attachment content in the file and the directory used is temp_directory. As per the use case we have to save the content passed from the cloud server to the file and file is opened by using the intents. This approach is working fine for the os version upto Android 5.0 (lollipop) but on the Android 6.0 (Marshmallow) it’s failing. h6.Steps to reproduce 1) Get sample attach to run on Android 5 device 2) Monitor and watch logs. App works fine 3) Get sample attach to run on Android 6 device 4) Monitor and watch logs. App won't load file as expected. h6.Stack Trace {code} -- Start application log ----------------------------------------------------- [INFO] : TiApplication: (main) [0,0] checkpoint, app created. [INFO] : TiApplication: (main) [58,58] Titanium 5.1.2 (2015/12/16 19:00 ca822b2) [INFO] : DatabaseHelper: No value in database for platform key: 'unique_machine_id' returning supplied default '' [INFO] : DatabaseHelper: No value in database for platform key: 'hardware_machine_id' returning supplied default '' [WARN] : art: Suspending all threads took: 5.501ms [INFO] : art: Background sticky concurrent mark sweep GC freed 512(22KB) AllocSpace objects, 0(0B) LOS objects, 1% free, 2MB/2MB, paused 6.183ms total 22.877ms [INFO] : TiApplication: (main) [263,321] Titanium Javascript runtime: v8 [INFO] : TiRootActivity: (main) [0,0] checkpoint, on root activity create, savedInstanceState: null [WARN] : V8Object: (KrollRuntimeThread) [249,249] Runtime disposed, cannot set property 'userAgent' [DEBUG] : APSAnalyticsModel: Creating Database appcAnalytics.db [WARN] : TiTempFileHelper: (main) [354,603] The external temp directory doesn't exist, skipping cleanup [DEBUG] : Module: Loading module: alloy -> Resources/alloy.js [DEBUG] : Module: Loading module: alloy/underscore -> Resources/alloy/underscore.js [DEBUG] : Module: Loading module: alloy/backbone -> Resources/alloy/backbone.js [DEBUG] : Module: Loading module: alloy/constants -> Resources/alloy/constants.js [DEBUG] : Module: Loading module: alloy/CFG -> Resources/alloy/CFG.js [DEBUG] : Module: Loading module: alloy/controllers/index -> Resources/alloy/controllers/index.js [DEBUG] : Module: Loading module: alloy/controllers/BaseController -> Resources/alloy/controllers/BaseController.js [INFO] : TiRootActivity: (main) [0,0] checkpoint, on root activity resume. activity = com.example.Docx_pocActivity@b56e552 [DEBUG] : OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true [DEBUG] : D/ : HostConnection::get() New Host Connection established 0xec8fdc10, tid 10299 [DEBUG] : Window: Checkpoint: postWindowCreated() [DEBUG] : libEGL: loaded /system/lib/egl/libEGL_emulation.so [DEBUG] : libEGL: loaded /system/lib/egl/libGLESv1_CM_emulation.so [DEBUG] : libEGL: loaded /system/lib/egl/libGLESv2_emulation.so [DEBUG] : D/ : HostConnection::get() New Host Connection established 0xed661cf0, tid 10318 [INFO] : OpenGLRenderer: Initialized EGL, version 1.4 [WARN] : EGL_emulation: eglSurfaceAttrib not implemented [WARN] : OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0xf3d3d160, error=EGL_SUCCESS [TRACE] : updating tiapp metadata with Appcelerator Platform... [TRACE] : Uploaded tiapp metadata with Appcelerator Platform! [ERROR] : TiFileProxy: (KrollRuntimeThread) [11875,11875] IOException encountered [ERROR] : TiFileProxy: java.io.FileNotFoundException: /storage/emulated/0/Android/data/com.example/cache/_tmp/sample.doc: open failed: ENOENT (No such file or directory) [ERROR] : TiFileProxy: libcore.io.IoBridge.open(IoBridge.java:452) [ERROR] : TiFileProxy: java.io.FileOutputStream.(FileOutputStream.java:87) [ERROR] : TiFileProxy: org.appcelerator.titanium.io.TiFile.getOutputStream(TiFile.java:273) [ERROR] : TiFileProxy: org.appcelerator.titanium.io.TiFile.open(TiFile.java:336) [ERROR] : TiFileProxy: org.appcelerator.titanium.io.TiFile.write(TiFile.java:382) [ERROR] : TiFileProxy: org.appcelerator.titanium.TiFileProxy.write(TiFileProxy.java:284) [ERROR] : TiFileProxy: org.appcelerator.kroll.runtime.v8.V8Object.nativeFireEvent(Native Method) [ERROR] : TiFileProxy: org.appcelerator.kroll.runtime.v8.V8Object.fireEvent(V8Object.java:62) [ERROR] : TiFileProxy: org.appcelerator.kroll.KrollProxy.doFireEvent(KrollProxy.java:908) [ERROR] : TiFileProxy: org.appcelerator.kroll.KrollProxy.handleMessage(KrollProxy.java:1131) [ERROR] : TiFileProxy: org.appcelerator.titanium.proxy.TiViewProxy.handleMessage(TiViewProxy.java:352) [ERROR] : TiFileProxy: android.os.Handler.dispatchMessage(Handler.java:98) [ERROR] : TiFileProxy: android.os.Looper.loop(Looper.java:148) [ERROR] : TiFileProxy: org.appcelerator.kroll.KrollRuntime$KrollRuntimeThread.run(KrollRuntime.java:112) [ERROR] : TiFileProxy: Caused by: android.system.ErrnoException: open failed: ENOENT (No such file or directory) [ERROR] : TiFileProxy: libcore.io.Posix.open(Native Method) [ERROR] : TiFileProxy: libcore.io.BlockGuardOs.open(BlockGuardOs.java:186) [ERROR] : TiFileProxy: libcore.io.IoBridge.open(IoBridge.java:438) [ERROR] : TiFileProxy:	... 13 more [ERROR] : Path/type is empty [INFO] : APSAnalyticsService: Analytics Service Started [INFO] : APSAnalyticsService: Stopping Analytics Service {code}
Story points: 5