简体   繁体   English

android 工作室的设备文件资源管理器中缺少数据库文件夹

[英]database folder is missing in device file explorer in android studio

I have created a sqlite database and table in android studio, but the sqlite database folder is missing in the device's file explorer.我在 android 工作室中创建了一个 sqlite 数据库和表,但设备的文件资源管理器中缺少 sqlite 数据库文件夹。 I have written the following code in the databasehelper.java class我在databasehelper.java class中写了如下代码

@Override
public void onCreate(SQLiteDatabase db) {
   db.execSQL("create table "+TABLE_NAME+"(sr INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT, datetime TEXT, location TEXT, odometer INTEGER, speed INTEGER, GPS TEXT, int.volt INTEGER, ext.volt INTEGER )");
}   

There might be a possibility that you have not connected the android device in USB file transfer mode.可能您没有在 USB 文件传输模式下连接 android 设备。 I had this issue in Android 9 and fixed it by connecting the device in USB file transfer mode.我在 Android 9 中遇到了这个问题,并通过以 USB 文件传输模式连接设备来修复它。

The default location of database is数据库的默认位置是

/data/data/<your_app_packagename>/databases/db_name. 

It is not accessible in non-rooted devices.在非 root 设备中无法访问它。 You can create your database in different location for debugging.您可以在不同位置创建数据库以进行调试。

solved this issue.解决了这个问题。 now my database folder is visible in device file explorer.现在我的数据库文件夹在设备文件资源管理器中可见。 i delete my old database.我删除了我的旧数据库。 also remove databaseHelper class.还删除 databaseHelper 类。 and create a fresh database and table.并创建一个新的数据库和表。 may be i missed some steps while creating database thats why database folder is missing.可能是我在创建数据库时错过了一些步骤,这就是数据库文件夹丢失的原因。 now its working.. thank you for ur help现在它的工作..谢谢你的帮助

Firstly you need to check that your database is successfully created or not, if your database is created then you can follow these steps:首先你需要检查你的数据库是否成功创建,如果你的数据库已经创建,那么你可以按照以下步骤操作:

  • Step1 : Debug you device with the breakpoint on the createdatabase().步骤 1:使用 createdatabase() 上的断点调试您的设备。
  • Step2 : After the successfully database create, Open the Device File Explorer, Go to the your Package and right click onto the package name.步骤2:成功创建数据库后,打开设备文件资源管理器,转到您的包并右键单击包名称。
  • Step3: Synchronize you package, now you will get your Database Step3:同步你的包,现在你会得到你的数据库

1 create table 2 upgrade table 3 insert value in table 4 (make sure that) add table field in List and call the method in MainActivity eg. 1 创建表 2 升级表 3 在表中插入值 4(确保)在 List 中添加表字段并调用 MainActivity 中的方法,例如。 - db.gelAlldata(); - db.gelAlldata(); 5 then run and synchronize ur project package 5 然后运行并同步你的项目 package

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Flutter Android Studio 中缺少设备文件资源管理器选项 - Device File Explorer option missing in Flutter Android Studio 更改Android Studio设备文件资源管理器的默认“另存为”文件夹 - Change default 'Save as…' folder of Device File Explorer of Android Studio Android Studio - 设备文件资源管理器图片目录 - Android Studio - Device File Explorer Picture Directory 在外部存储 android studio 设备资源管理器中找不到创建的文件夹 - folder created not found in external storage android studio device explorer 如何更改默认设置以在 Android Studio 的设备文件资源管理器中以文本形式打开数据库文件? - How to change the default set to open database files as text in Device File Explorer in Android Studio? 如何在Android Studio中从设备文件资源管理器查看sqlite数据库而不将其保存到系统 - How to view sqlite database from device file explorer in android studio without saving it to system Android Studio的SQLite数据库中的文件资源管理器 - File explorer in sqlite database of android studio 设备文件资源管理器-ROOM 数据库中的数据库文件夹为空 - Databases Folder Empty In Device File Explorer-ROOM Database 如何在没有Android Studio的情况下启动Android设备文件资源管理器? - How to start Android Device File Explorer without Android Studio? Android Studio-Android设备监视器的文件资源管理器不起作用 - Android Studio - Android Device Monitor's File explorer not working
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM