复制失败:java.io.FileNotFoundException:/data/data/packagename/databases/databasename.sqlite:open:failed:EACCES(Permission denied)

时间:2013-04-23 09:58:07

标签: android database-permissions android-permissions

我在安装我的应用程序并运行后,Nuxus 10与普通用户有问题....然后显示错误

java.lang.Error: Error copying database => java.io.FileNotFoundException: /data/data/packagename/databases/databasename.sqlite: open failed: ENOENT (No such file or directory)

如果我与管理员用户一起使用Nexus 10,则效果很好。

AndroidManifest:

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.SEND_SMS" />
<uses-permission android:name="android.permission.CALL_PHONE" />

<!-- Keeps the processor from sleeping when a message is received. -->
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.GET_TASKS" />

我尝试多次找到解决方案,但我仍然没有找到它。

你能告诉我解决方案吗? 谢谢,

1 个答案:

答案 0 :(得分:0)

根据您提供的信息,我可以告诉您数据库文件似乎不存在。检查它是这样的:

if(new File("/path/to/database").exists()) {
    // database access code comes here
} else {
    // database does not exists. Create it!
    // create directories if needed
    // and so on
}