java.io.FileNotFoundException

tip

Before using FileOutputStream check that there's no directory or file with the same name you're trying to use. Trying to remove it works as well. Try using FileAsyncHttpResponseHandler(context) as well!

You have a different solution? A short tip here would help you and many other users who saw this issue last week.

  • *Steps to reproduce:* 1. Add the code below to controllers/index.js: {code:javascript} function doClick(e) { var file = Ti.Filesystem.getFile(Ti.Filesystem.externalStorageDirectory, "test.txt"); file.write("i love writing to files"); } $.index.open(); {code} 2. Launch the app. 3. Click on the "Hello, World" text. *Results:* {code:java} 12-21 12:15:24.350: E/TiBlob(12960): (KrollRuntimeThread) [19,12681] /storage/emulated/0/com.androidwritefailure/test.txt: open failed: ENOENT (No such file or directory) 12-21 12:15:24.350: E/TiBlob(12960): java.io.FileNotFoundException: /storage/emulated/0/com.androidwritefailure/test.txt: open failed: ENOENT (No such file or directory) 12-21 12:15:24.350: E/TiBlob(12960): at libcore.io.IoBridge.open(IoBridge.java:452) 12-21 12:15:24.350: E/TiBlob(12960): at java.io.FileInputStream.<init>(FileInputStream.java:76) 12-21 12:15:24.350: E/TiBlob(12960): at org.appcelerator.titanium.io.TiFile.getInputStream(TiFile.java:264) 12-21 12:15:24.350: E/TiBlob(12960): at org.appcelerator.titanium.TiBlob.getInputStream(TiBlob.java:389) 12-21 12:15:24.350: E/TiBlob(12960): at org.appcelerator.titanium.TiBlob.guessContentTypeFromStream(TiBlob.java:209) 12-21 12:15:24.350: E/TiBlob(12960): at org.appcelerator.titanium.TiBlob.loadBitmapInfo(TiBlob.java:270) 12-21 12:15:24.350: E/TiBlob(12960): at org.appcelerator.titanium.TiBlob.blobFromFile(TiBlob.java:140) 12-21 12:15:24.350: E/TiBlob(12960): at org.appcelerator.titanium.TiBlob.blobFromFile(TiBlob.java:113) 12-21 12:15:24.350: E/TiBlob(12960): at org.appcelerator.titanium.io.TiFile.read(TiFile.java:351) 12-21 12:15:24.350: E/TiBlob(12960): at org.appcelerator.titanium.TiFileProxy.read(TiFileProxy.java:239) {code} *Notes:* The code is working in Android 5.1 and Android 5.0.
    via by Jacob Budin,
  • *Steps to reproduce:* 1. Add the code below to controllers/index.js: {code:javascript} function doClick(e) { var file = Ti.Filesystem.getFile(Ti.Filesystem.externalStorageDirectory, "test.txt"); file.write("i love writing to files"); } $.index.open(); {code} 2. Launch the app. 3. Click on the "Hello, World" text. *Results:* {code:java} 12-21 12:15:24.350: E/TiBlob(12960): (KrollRuntimeThread) [19,12681] /storage/emulated/0/com.androidwritefailure/test.txt: open failed: ENOENT (No such file or directory) 12-21 12:15:24.350: E/TiBlob(12960): java.io.FileNotFoundException: /storage/emulated/0/com.androidwritefailure/test.txt: open failed: ENOENT (No such file or directory) 12-21 12:15:24.350: E/TiBlob(12960): at libcore.io.IoBridge.open(IoBridge.java:452) 12-21 12:15:24.350: E/TiBlob(12960): at java.io.FileInputStream.<init>(FileInputStream.java:76) 12-21 12:15:24.350: E/TiBlob(12960): at org.appcelerator.titanium.io.TiFile.getInputStream(TiFile.java:264) 12-21 12:15:24.350: E/TiBlob(12960): at org.appcelerator.titanium.TiBlob.getInputStream(TiBlob.java:389) 12-21 12:15:24.350: E/TiBlob(12960): at org.appcelerator.titanium.TiBlob.guessContentTypeFromStream(TiBlob.java:209) 12-21 12:15:24.350: E/TiBlob(12960): at org.appcelerator.titanium.TiBlob.loadBitmapInfo(TiBlob.java:270) 12-21 12:15:24.350: E/TiBlob(12960): at org.appcelerator.titanium.TiBlob.blobFromFile(TiBlob.java:140) 12-21 12:15:24.350: E/TiBlob(12960): at org.appcelerator.titanium.TiBlob.blobFromFile(TiBlob.java:113) 12-21 12:15:24.350: E/TiBlob(12960): at org.appcelerator.titanium.io.TiFile.read(TiFile.java:351) 12-21 12:15:24.350: E/TiBlob(12960): at org.appcelerator.titanium.TiFileProxy.read(TiFileProxy.java:239) {code} *Notes:* The code is working in Android 5.1 and Android 5.0.
    via by Jacob Budin,
  • Problems with Android 6.0
    via GitHub by naoliv
    ,
  • I recently upgraded to 20160319-nightly from 20160315-nightly. Before that, I was running 20160227-nightly. OpenGApps is 20160320-aroma. Since the upgrade to 20160315 (and now 20160319), I cannot install any .apk packages anymore. Installing from Play Store works but when I try to install something using the package installer by selecting an .apk file directly, I always get the "Parse error" message, no matter which app I try. ADB log as follows: 03-20 20:28:25.294 11933 11933 W : Unable to open '/storage/emulated/0/Download/nzb360.apk': Permission denied 03-20 20:28:25.295 11933 11933 W zipro : Error opening archive /storage/emulated/0/Download/nzb360.apk: I/O Error 03-20 20:28:25.295 11933 11933 D asset : failed to open Zip archive '/storage/emulated/0/Download/nzb360.apk' 03-20 20:28:25.296 11933 11933 W PackageInstaller: Parse error when parsing manifest. Discontinuing installation 03-20 20:28:25.333 11933 11948 D OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true 03-20 20:28:25.368 11933 11949 W InstallFlowAnalytics: Failed to hash APK contents 03-20 20:28:25.368 11933 11949 W InstallFlowAnalytics: java.io.FileNotFoundException: /storage/emulated/0/Download/nzb360.apk: open failed: EACCES (Permission denied) 03-20 20:28:25.368 11933 11949 W InstallFlowAnalytics: at libcore.io.IoBridge.open(IoBridge.java:452) 03-20 20:28:25.368 11933 11949 W InstallFlowAnalytics: at java.io.FileInputStream.<init>(FileInputStream.java:76) 03-20 20:28:25.368 11933 11949 W InstallFlowAnalytics: at de.robv.android.xposed.XposedBridge.invokeOriginalMethodNative(Native Method) 03-20 20:28:25.368 11933 11949 W InstallFlowAnalytics: at de.robv.android.xposed.XposedBridge.handleHookedMethod(XposedBridge.java:675) 03-20 20:28:25.368 11933 11949 W InstallFlowAnalytics: at java.io.FileInputStream.<init>(<Xposed>) 03-20 20:28:25.368 11933 11949 W InstallFlowAnalytics: at com.android.packageinstaller.InstallFlowAnalytics.getSha256ContentsDigest(InstallFlowAnalytics.java:598) 03-20 20:28:25.368 11933 11949 W InstallFlowAnalytics: at com.android.packageinstaller.InstallFlowAnalytics.getPackageContentsDigest(InstallFlowAnalytics.java:581) 03-20 20:28:25.368 11933 11949 W InstallFlowAnalytics: at com.android.packageinstaller.InstallFlowAnalytics.-wrap0(InstallFlowAnalytics.java) 03-20 20:28:25.368 11933 11949 W InstallFlowAnalytics: at com.android.packageinstaller.InstallFlowAnalytics$2.run(InstallFlowAnalytics.java:467) 03-20 20:28:25.368 11933 11949 W InstallFlowAnalytics: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) 03-20 20:28:25.368 11933 11949 W InstallFlowAnalytics: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) 03-20 20:28:25.368 11933 11949 W InstallFlowAnalytics: at java.lang.Thread.run(Thread.java:818) 03-20 20:28:25.368 11933 11949 W InstallFlowAnalytics: Caused by: android.system.ErrnoException: open failed: EACCES (Permission denied) 03-20 20:28:25.368 11933 11949 W InstallFlowAnalytics: at libcore.io.Posix.open(Native Method) 03-20 20:28:25.368 11933 11949 W InstallFlowAnalytics: at libcore.io.BlockGuardOs.open(BlockGuardOs.java:186) 03-20 20:28:25.368 11933 11949 W InstallFlowAnalytics: at libcore.io.IoBridge.open(IoBridge.java:438) 03-20 20:28:25.368 11933 11949 W InstallFlowAnalytics: ... 11 more
    via by SoWhy,
  • GitHub comment 329#214022695
    via GitHub by mathstuf
    ,
  • mGerrit crashes [F-Droid build]
    via GitHub by marmistrz
    ,
  • GitHub comment 53#265197816
    via GitHub by vitamin-caig
    ,
    • java.io.FileNotFoundException: /storage/emulated/0/com.androidwritefailure/test.txt: open failed: ENOENT (No such file or directory) at libcore.io.IoBridge.open(IoBridge.java:452) at java.io.FileInputStream.<init>(FileInputStream.java:76) at org.appcelerator.titanium.io.TiFile.getInputStream(TiFile.java:264) at org.appcelerator.titanium.TiBlob.getInputStream(TiBlob.java:389) at org.appcelerator.titanium.TiBlob.guessContentTypeFromStream(TiBlob.java:209) at org.appcelerator.titanium.TiBlob.loadBitmapInfo(TiBlob.java:270) at org.appcelerator.titanium.TiBlob.blobFromFile(TiBlob.java:140) at org.appcelerator.titanium.TiBlob.blobFromFile(TiBlob.java:113) at org.appcelerator.titanium.io.TiFile.read(TiFile.java:351) at org.appcelerator.titanium.TiFileProxy.read(TiFileProxy.java:239)

    Users with the same issue

    Indri Yunita
    1 times, last one,
    Diogo Jaym
    1 times, last one,
    spe
    5 times, last one,
    dmitry
    1 times, last one,
    bayukresno
    2 times, last one,
    96 more bugmates