Viewing private files created by an android app

后端 未结 5 1032
情歌与酒
情歌与酒 2021-02-04 01:53

I have an xml file being written by an app that is set to MODE_PRIVATE, but I now want to read that file outside of the phone, for debugging purposes. In Eclipse, I can access o

5条回答
  •  说谎
    说谎 (楼主)
    2021-02-04 02:33

    You will need to connect the phone and do some magic to let your sdk work with it (I think put it in debugging mode?). Go to where you unzipped the android sdk:

    C:\android-sdk_r10-windows\android-sdk-windows\platform-tools>adb shell
    #cd data/data/com.yourpackage.yourapp/files
    #ls
    

    You should see your file listed. You may need to run "ls data/data" if you're not sure what the fully-qualified name of your app is. From here if the file is small and you just want to see what's inside it you can run:

    #cat yourfilename.xml
    

    Alternatively:

    #exit
    C:\android-sdk_r10-windows\android-sdk-windows\platform-tools>adb pull /data/data/com.yourpackage.yourapp/files/yourfile.xml
    

    Note: I have only tried this on the emulator, I don't know how to use adb with a physical phone.

提交回复
热议问题