Trying to create a file in Android: open failed: EROFS (Read-only file system)

前端 未结 8 2357
臣服心动
臣服心动 2020-11-27 05:52

This line:

final FileOutputStream outputStream = new FileOutputStream(name);

results in a FileNotFoundException with the messa

8条回答
  •  粉色の甜心
    2020-11-27 06:22

    As others have mentioned, app on Android can't write a file to any folder the internal storage but their own private storage (which is under /data/data/PACKAGE_NAME ).

    You should use the API to get the correct path that is allowed for your app.

    read this .

提交回复
热议问题