Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Android studio :open failed: ENOENT (No such file or directory) error

I have this method. The problem is that in Android studio the excel path doesn’t exist, but if I use the code in IntelliJ it works perfectly fine. Please help me to understand this issue.
I have this in manifest too:

    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
    tools:ignore="ScopedStorage" />
   private static String findRow(String cellContent) throws IOException {
        String excelPath="C:\\Users\\mely\\AndroidStudioProjects\\exportingfile.xlsx";
        FileInputStream inputStream=new FileInputStream(excelPath);
        XSSFWorkbook workbook=new XSSFWorkbook(inputStream);
        XSSFSheet sheet=workbook.getSheetAt(0);
        for (Row row : sheet) {
            for (Cell cell : row) {
                if (cell.getRichStringCellValue().getString().trim().equals(cellContent)) {
                    return sheet.getRow(row.getRowNum()).getCell(9).toString();
                }

            }
        }
        return "";
    } ```



>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

="C:\Users\mely\AndroidStudioProjects\exportingfile.xlsx"

C: is a partition on a hard disk on a Windows PC.

It is not a valid storage path on an Android device.

Your app on an Android device has no access to files on a Windows PC.

Not to your PC, not to mines.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading