我想看看在模拟器/data/data/com.android.provider.contacts 下面的contacts.db文件
我的想法是用adb shell把它拷贝出来,再用其它软件打开。
但是在adb shell中运行cp命令把它拷贝到D:\test
 cp /data/data/com.android.provider.contacts/contacts.db d:\test  不行。
请各位告诉我一个可行的方法。

解决方案 »

  1.   

     adb pull <remote> [<local>]  - copy file/dir from device在电脑上操作local就是指电脑上存放路径,remote指手机中文件存放路径,contacts.db是放在<package_path>/databases下的adb pull /data/data/com.android.provider.contacts/databases/contacts.db D:\test
    先弄到d:盘到拷到别的地方吧查看db文件的话可以用SQLite Database Browser
    下载地址:
    http://sourceforge.net/projects/sqlitebrowser/
      

  2.   

    可以了 我先前先运行adb shell在用cp命令怎么不行呢
      

  3.   

    adb shell里什么时候有cp命令了?安装一个busybox吧。
      

  4.   

    关键是我的databases目录下没有contacts。db文件啊,只有个contacts2.db
    而且里面也没有people表啊
      

  5.   

    “可以了 我先前先运行adb shell在用cp命令怎么不行呢”cp命令是针对设备内部的,无法操作设备之外的空间
    “关键是我的databases目录下没有contacts。db文件啊,只有个contacts2.db”我的也只有contacts2.db,一楼回复时参考楼主给的参数没有把2写上
    “而且里面也没有people表啊”
    楼主哪看的contacts2.db有people表,如果要查联系人资料的话,可以在raw_contacts中查
      

  6.   

    用SQLITE3 命令啊如果你要看的话,adb shell 命令进入 shell后,sqlite3 path/*.db,进入SQL状态,然后就可以用SQL命令了,.tables看所有,select * from 键名,和SQL命令一样的
      

  7.   


    学习,我想问下怎么从sql状态中回到adb shell呢??
      

  8.   

    ok,学习了sqlite3
    SQLite version 3.6.22
    Enter ".help" for instructions
    Enter SQL statements terminated with a ";"
    sqlite> .help
    .help
    .backup ?DB? FILE      Backup DB (default "main") to FILE
    .bail ON|OFF           Stop after hitting an error.  Default OFF
    .databases             List names and files of attached databases
    .dump ?TABLE? ...      Dump the database in an SQL text format
                             If TABLE specified, only dump tables matching
                             LIKE pattern TABLE.
    .echo ON|OFF           Turn command echo on or off
    .exit                  Exit this program
    .explain ?ON|OFF?      Turn output mode suitable for EXPLAIN on or off.
                             With no args, it turns EXPLAIN on.
    .genfkey ?OPTIONS?     Options are:
                             --no-drop: Do not drop old fkey triggers.
                             --ignore-errors: Ignore tables with fkey errors
                             --exec: Execute generated SQL immediately
                           See file tool/genfkey.README in the source
                           distribution for further information.
    .header(s) ON|OFF      Turn display of headers on or off
    .help                  Show this message
    .import FILE TABLE     Import data from FILE into TABLE
    .indices ?TABLE?       Show names of all indices
                             If TABLE specified, only show indices for tables
                             matching LIKE pattern TABLE.
    .load FILE ?ENTRY?     Load an extension library
    .log FILE|off          Turn logging on or off.  FILE can be stderr/stdout
    .mode MODE ?TABLE?     Set output mode where MODE is one of:
                             csv      Comma-separated values
                             column   Left-aligned columns.  (See .width)
                             html     HTML <table> code
                             insert   SQL insert statements for TABLE
                             line     One value per line
                             list     Values delimited by .separator string
                             tabs     Tab-separated values
                             tcl      TCL list elements
    .nullvalue STRING      Print STRING in place of NULL values
    .output FILENAME       Send output to FILENAME
    .output stdout         Send output to the screen
    .prompt MAIN CONTINUE  Replace the standard prompts
    .quit                  Exit this program
    .read FILENAME         Execute SQL in FILENAME
    .restore ?DB? FILE     Restore content of DB (default "main") from FILE
    .schema ?TABLE?        Show the CREATE statements
                             If TABLE specified, only show tables matching
                             LIKE pattern TABLE.
    .separator STRING      Change separator used by output mode and .import
    .show                  Show the current values for various settings
    .tables ?TABLE?        List names of tables
                             If TABLE specified, only list tables matching
                             LIKE pattern TABLE.
    .timeout MS            Try opening locked tables for MS milliseconds
    .width NUM1 NUM2 ...   Set column widths for "column" mode
    .timer ON|OFF          Turn the CPU timer measurement on or off
    sqlite> .exit
    .exit
    # exit
    exit
      

  9.   

    貌似版本低的话是没集成进SQL LITE客户端的
    需要先导出来 推荐用firefox的SQL LITE插件查看
      

  10.   

    哪位大哥 帮我看看我的contacts2.db 留下邮件啊
    我创建了一个联系人Test1也添加了号码,为什么就看不到呢?
      

  11.   


    people表是以前的版本用的,如果你的数据库是contacts2.db那所有的数据都在 data 那个表里,raw_contacts也有点。有一个视图叫“view_data_restricted”,相关的东西都在里面了。
      

  12.   

    这个应该在data下面   要不发给我  帮你看看[email protected]
      

  13.   


    我试了试命令什么都没有显示D:\adb>adb shell
    # sqlite
    sqlite
    sqlite: not found
    # sqlite /data/data/com.android.providers.contacts/databases/contacts2.db
    sqlite /data/data/com.android.providers.contacts/databases/contacts2.db
    sqlite: not found
    # sqlite3 /data/data/com.android.providers.contacts/databases/contacts2.db
    sqlite3 /data/data/com.android.providers.contacts/databases/contacts2.db
    SQLite version 3.6.22
    Enter ".help" for instructions
    Enter SQL statements terminated with a ";"
    sqlite> .tables
    .tables
    BigPhotoData                      properties
    _sync_state                       raw_contacts
    _sync_state_metadata              settings
    accounts                          status_updates
    activities                        v1_settings
    agg_exceptions                    view_contacts
    android_metadata                  view_contacts_restricted
    calls                             view_data
    contact_entities_view             view_data_restricted
    contact_entities_view_restricted  view_groups
    contacts                          view_raw_contacts
    data                              view_raw_contacts_restricted
    groups                            view_v1_contact_methods
    groups_photo_data                 view_v1_extensions
    mimetypes                         view_v1_group_membership
    name_lookup                       view_v1_groups
    nickname_lookup                   view_v1_organizations
    packages                          view_v1_people
    phone_lookup                      view_v1_phones
    pinyin                            view_v1_photos
    sqlite> select * form data
    select * form data
       ...> select * form view_data_restricted
    select * form view_data_restricted
       ...>