[英]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.