“Invalid file format” from device pulled *.db file in Nexus 4 - Android 5.1.1

夙愿已清 提交于 2019-12-02 07:47:53

问题


I'm learning Android developement. And I receive always this error while opening a pulled database file from device: "Invalid file format"

I use this commands to pull the

adb shell "run-as package chmod 666 /data/data/package/files/database"
adb exec-out run-as package cat files/database > C://test/database

I thik, the file size is correct, and when I open it in with a text editor I can read the content, with special characters, of course. But the sqliteBrowser can't read it.


回答1:


I had a same problem with android 4.2, although I used ubuntu 16.04 and sqlite browser instead.

I found only one way that I could access my not rooted phone's file system and finally I could open the database file.

Install SSHDroid on your phone

adb -d shell "run-as your.package.name cat databases/database_name.db > /mnt/sdcard/database_name.db"

just for sure, you can check whether the file is there

$ adb shell
shell@android:/ $ cd /mnt/sdcard
shell@android:/mnt/sdcard $ ls

if you don't know the exact name of your package then

adb shell 'pm list packages -f'

start the SSHDroid

the default username is root and the default password is admin. It makes sense to change the password.

start FileZilla
open the Site Manager and add a new site with the settings of the SSHDroid's ssh server.

set /mnt/sdcard as default remote directory

and connect to your phone via SFTP protocol



来源:https://stackoverflow.com/questions/33316687/invalid-file-format-from-device-pulled-db-file-in-nexus-4-android-5-1-1

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!