简体   繁体   English

java.io.FileNotFoundException:[文件路径](没有这样的文件或目录)

[英]java.io.FileNotFoundException: [filepath] (No such file or directory)

I'm trying to read from a file but i'm getting false on the check. 我正在尝试从文件中读取内容,但支票上的内容却是虚假的。 I can't see why this is happning, The file exist i have a multible time just to be sure. 我不明白为什么会这样,文件存在,我有很多时间可以确定。

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

I also have included this in the AndroidManifest.xml file so that is not the problem either. 我还将其包含在AndroidManifest.xml文件中,因此也不是问题。

    String filePath = Environment.getExternalStorageDirectory() + "/folder/Save.spm";
    File filecheck = new File(filePath);
    if(filecheck.exists() == false)
    {
        return false;
    }
    FileInputStream file = new FileInputStream(filePath);
    DataInputStream input = new DataInputStream(file);

Why does android claim that the file does not exist? 为什么Android声称该文件不存在?

How did you check that the file exists ? 您如何检查文件是否存在? Have your tried using the ADB pull command to retrieve the file back from the emulator (if you are using one) ? 您是否尝试过使用ADB pull命令从仿真器中取回文件(如果使用的是)?

adb pull /path/to/file

Get the absolute path for filecheck and try that. 获取文件检查的绝对路径,然后尝试尝试。 It is also possible that you are mistaking the application cache directory with the external storage. 您还可能将应用程序缓存目录与外部存储区混淆。 Or may be there is more than one external storage and you are looking at the wrong one. 或者可能有多个外部存储,而您正在寻找错误的外部存储。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 java.io.FileNotFoundException:..(无此类文件或目录) - java.io.FileNotFoundException: .. (No such file or directory) java.io.FileNotFoundException:没有这样的文件或目录错误 - java.io.FileNotFoundException: No such file or directory Error java.io.FileNotFoundException(是一个目录) - java.io.FileNotFoundException (Is a directory) java.io.IOException:java.io.FileNotFoundException :(无此类文件或目录) - java.io.IOException: java.io.FileNotFoundException:(No such file or directory) java.io.FileNotFoundException没有此类文件或目录错误,但目录存在 - java.io.FileNotFoundException No such file or directory error but directory exists Linux java没有此类文件或目录,java.io.FileNotFoundException: - Linux java No such file or directory, java.io.FileNotFoundException: Java FileWriter 类 - java.io.FileNotFoundException: * 没有这样的文件或目录 -Ubuntu - Java FileWriter class - java.io.FileNotFoundException: * no such file or directory -Ubuntu java.io.FileNotFoundException(没有这样的文件或目录) - 下载文件 - java.io.FileNotFoundException (No such file or directory) - Download File java.io.FileNotFoundException:(无此类文件或目录)-使用servlet - java.io.FileNotFoundException: (No such file or directory) - Working with servlets 尝试访问.wav文件时java.io.FileNotFoundException(不是目录) - java.io.FileNotFoundException (Not a directory) when attempting to access a .wav file
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM