简体   繁体   English

错误“打开失败:ENOENT(没有这样的文件或目录)”

[英]Error "open failed: ENOENT (No such file or directory)"

I have a code that worked well on eclipse and now I moved to Android Studio and there for some reason I cannot open the.xls file.我有一个在 eclipse 上运行良好的代码,现在我搬到了 Android Studio,由于某种原因我无法打开 .xls 文件。

I am using jxl librariy, so I added the jar to the project's lib, and: <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> to the manifest.我正在使用 jxl 库,所以我将 jar 添加到项目的库中,并将: <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />添加到清单中。 The code for opening the file is:打开文件的代码是:

final String EXCEL_FILE_LOCATION = "src/exercise.xls";
    Workbook workbook = Workbook.getWorkbook(new File(EXCEL_FILE_LOCATION));

The file and the directory both exist for sure and yet it throws the exeption W/System.err: java.io.FileNotFoundException: src/exercise.xls: open failed: ENOENT (No such file or directory)该文件和目录肯定存在,但它抛出异常W/System.err: java.io.FileNotFoundException: src/exercise.xls: open failed: ENOENT (No such file or directory)

What am I doing wrong?我究竟做错了什么?

Try to add this in your Manifest:尝试将此添加到您的清单中:

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:requestLegacyExternalStorage="true" //Add this Line
android:label="@string/app_name">

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

相关问题 错误:打开失败:ENOENT(没有那个文件或目录) - Error: open failed: ENOENT (No such file or directory) 打开失败:ENOENT(没有此类文件或目录)错误 - open failed:ENOENT (No such file or directory) error Android:打开失败:ENOENT(无此类文件或目录)错误 - Android: open failed: ENOENT (No such file or directory) Error fileInputStream(file)提供打开失败:ENOENT(无此类文件或目录)错误 - fileInputStream(file) gives open failed: ENOENT (No such file or directory) error 要将图像发布到Twitter中,得到错误:打开失败:ENOENT(无此文件或目录) - To post the image in twitter,getting Error:open failed: ENOENT (No such file or directory) Android:NDK:超级打开失败:ENOENT(没有这样的文件或目录)错误 - Android : NDK : Superpowered Open failed: ENOENT (No such file or directory) Error 写入存储打开失败时出错:android 中的 ENOENT (No such file or directory) - Error while writing storage open failed: ENOENT (No such file or directory) in android BitmapFactory 打开失败:ENOENT(没有那个文件或目录) - BitmapFactory open failed: ENOENT (No such file or directory) Android解压缩失败:ENOENT(无此文件或目录) - Android unzip open failed: ENOENT (No such file or directory) Android:打开失败:ENOENT没有这样的文件或目录 - Android: open failed: ENOENT No such file or directory
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM