通过查看一个Android应用程序创建的私人文件应用程序、私人、文件、Android

2023-09-06 13:48:27 作者:最佳观众

我有一个XML文件被写入由设置为MODE_PRIVATE一个应用程序,但我现在想读取该文件在手机之外,出于调试的目的。在Eclipse中,我可以访问应用程序提出的其他文件,并将其复制到我的电脑,但我甚至不能看到这个私人文件。仅仅改变文件MODE_WORLD_READABLE文件似乎并没有帮助。我认为该文件被存储在一个内部SD卡,不能从手机中删除,但也有在文件浏览其他两个文件夹或者是空的或无法访问:ASEC和安全

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 other files made by the app and copy them to my computer, but I can't even see this private file. Merely changing the file to MODE_WORLD_READABLE file doesn't seem to help. I think the file is being stored on an internal "SD card" that can not be removed from the phone, but there are also two other folders in the File Explorer that are either empty or inaccessible: asec and secure.

有谁知道该文件可以被访问?

Does anyone know how the file can be accessed?

推荐答案

您需要连接手机和一些魔法,让你的SDK工作,(我觉得把它在调试模式?)。转到您解压缩Android SDK的:

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

您应该看到您的文件中列出。您可能需要运行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

或者

#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.

 
精彩推荐
图片推荐