一.文件相关

1.cache.txt: open failed: EROFS (Read-only file system)

  • 原因:
ObjectOutputStream outputStream = new ObjectOutputStream(new FileOutputStream("test.txt"));

现在有些手机不允许我们直接向sd card上写东西,因此做如下修改:

String fname = Environment.getExternalStorageDirectory() + "/test.txt";
ObjectOutputStream outputStream = new ObjectOutputStream(new FileOutputStream(fname));

你可能感兴趣的:(一.文件相关)