Java 打开以前下载的数据库

Java 打开以前下载的数据库,java,android,firebase,android-sqlite,firebase-storage,Java,Android,Firebase,Android Sqlite,Firebase Storage,这个程序从firebase存储中下载一个文件, 我的下载代码是: private void downloadFiles(Context context, String fileName, String destinationDirectory, String url) { DownloadManager downloadManager = (DownloadManager) context.getSystemService(Context.DOWNLOAD_SERVICE); U

这个程序从firebase存储中下载一个文件, 我的下载代码是:

private void downloadFiles(Context context, String fileName, String destinationDirectory, String url) {
    DownloadManager downloadManager = (DownloadManager) context.getSystemService(Context.DOWNLOAD_SERVICE);
    Uri uri = Uri.parse(url);
    DownloadManager.Request request = new DownloadManager.Request(uri);

    request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
    request.setDestinationInExternalFilesDir(context, destinationDirectory, fileName);

    downloadManager.enqueue(request);
}

public void downloading(final String name) {
    downloadRef = storage.getInstance().getReference().child(name);
    downloadRef.getDownloadUrl().addOnSuccessListener(new OnSuccessListener<Uri>() {
        @Override
        public void onSuccess(Uri uri) {
            String url = uri.toString();
            downloadFiles(Main2Activity.this, name,  Environment.getExternalStorageState((File) Downloads), url);
        }
    }).addOnFailureListener(new OnFailureListener() {
        @Override
        public void onFailure(@NonNull Exception e) {
            Toast.makeText(Main2Activity.this, "Failed!!!", Toast.LENGTH_LONG).show();
        }
    });
}
但是它说

原因:android.database.sqlite.SQLiteCantOpenDatabaseException:未知错误(代码14):无法打开数据库


我如何解决这个问题?

很难说问题是从哪里来的。要解决问题,我建议使用设备管理器从Android设备中提取sqlite文件,然后查看是否可以在本地打开它。如果没有,你至少知道问题出在如何下载和保存数据上,这样你就可以更好地调查设备上的文件有什么问题。@FrankvanPuffelen嘿!我试图从模拟器中用sqlite编辑器打开我的数据库文件,结果成功了,打开时出现问题database@FrankvanPuffelen嘿,我真的希望我没有打扰你,但是我现在没有希望了,我试着搜索整个互联网,但是没有找到答案,你有什么办法可以帮我吗?很难说问题出在哪里。要解决问题,我建议使用设备管理器从Android设备中提取sqlite文件,然后查看是否可以在本地打开它。如果没有,你至少知道问题出在如何下载和保存数据上,这样你就可以更好地调查设备上的文件有什么问题。@FrankvanPuffelen嘿!我试图从模拟器中用sqlite编辑器打开我的数据库文件,结果成功了,打开时出现问题database@FrankvanPuffelen嘿,我真的希望我没有打扰你,但我现在没有希望了,我试图搜索整个互联网,但无法解决,你有什么办法可以帮我吗?
database = SQLiteDatabase.openDatabase(Environment.getExternalStorageState((File) Downloads) + "/" + name, null, SQLiteDatabase.OPEN_READWRITE);