Android上的异常“打开失败:EACCES(权限被拒绝)”我得到了打开失败:EACCES (Permission denied)在线上OutputStream myOutput = new FileOutputStream(outFileName);我检查了根,我试着android.permission.WRITE_EXTERNAL_STORAGE.我怎样才能解决这个问题?try {
InputStream myInput;
myInput = getAssets().open("XXX.db");
// Path to the just created empty db
String outFileName = "/data/data/XX/databases/"
+ "XXX.db";
// Open the empty db as the output stream
OutputStream myOutput = new FileOutputStream(outFileName);
// Transfer bytes from the inputfile to the outputfile
byte[] buffer = new byte[1024];
int length;
while ((length = myInput.read(buffer)) > 0) {
myOutput.write(buffer, 0, length);
}
// Close the streams
myOutput.flush();
myOutput.close();
myInput.close();
buffer = null;
outFileName = null;}catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();}
3 回答
慕哥9229398
TA贡献1877条经验 获得超6个赞
<uses-permission
<manifest> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> ... <application> ... <activity> ... </activity> </application> </manifest>
uses-permission
application
白衣染霜花
TA贡献1796条经验 获得超10个赞
- 3 回答
- 0 关注
- 4349 浏览
添加回答
举报
0/150
提交
取消