Android: Delete entire database

2020-06-04 04:52发布

I would like to delete a complete database created by my application.

Do you know any adb command, or android sentence to do it?

6条回答
Juvenile、少年°
2楼-- · 2020-06-04 05:24

I think you need to start up your emulator with the command: -wipe-data

查看更多
走好不送
3楼-- · 2020-06-04 05:28

Perhaps this is too obvious but uninstalling the application via Manage Applications will remove the db, assuming it's in the application's files dir.

查看更多
贼婆χ
4楼-- · 2020-06-04 05:28

The clear data button will actually delete the database without uninstalling the entire app.

查看更多
我命由我不由天
5楼-- · 2020-06-04 05:33

Also, in Eclipse you can go to "Window -> Show View -> Other... -> Android -> File Explorer"

Then navigate to "data/data//databases"

Select the database file, then click the red minus sign to "delete the selection"

查看更多
虎瘦雄心在
6楼-- · 2020-06-04 05:38

go to DDMS->FleExplorer-data/data/packagename/databases/name_of_database

click on the name_of_database and press the red minus!

If you don't have the FileExplorer go to Window->ShowView->FileExplorer

查看更多
啃猪蹄的小仙女
7楼-- · 2020-06-04 05:43

You can run the command:

adb -s emulator-5554 shell (or whatever port you use)
cd /data/data/<packagename>/databases/

By typing ls, you will see the databases created and you can remove the one you want with rm

rm myapp.db

See more here

查看更多
登录 后发表回答