gpt4 book ai didi

android - Nexus 4 未通过 MTP 显示文件

转载 作者:IT老高 更新时间:2023-10-28 13:11:21 28 4
gpt4 key购买 nike

我正在尝试简单地将一个简单的 XML 文件写入 SD 卡,我注意到我的 Nexus 4 确实写入了该文件,但使用 Windows 7 通过 MTP 协议(protocol)无法查看它。

代码:

public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);

CustomerQueryRqType customerQueryRequest = new CustomerQueryRqType();
Serializer serializer = new Persister();
File myFile = new File(Environment.getExternalStorageDirectory() + "/customerQueryRequest.xml");

try {
boolean created = myFile.createNewFile();
serializer.write(customerQueryRequest, myFile);
} catch (Exception e) {
e.printStackTrace();
}
}

我可以使用 Astro 文件管理器在手机上查看文件:

Screenshot

但 Windows 看不到它...:

Screenshot

adb shell上的目录显示:

ls -l
drwxrwxr-x root sdcard_rw 1970-01-16 20:51 Alarms
drwxrwxr-x root sdcard_rw 1970-01-16 20:51 Android
drwxrwxr-x root sdcard_rw 2012-11-21 19:30 DCIM
drwxrwxr-x root sdcard_rw 1970-01-16 20:51 Download
drwxrwxr-x root sdcard_rw 1970-01-16 20:51 Movies
drwxrwxr-x root sdcard_rw 1970-01-16 20:51 Music
drwxrwxr-x root sdcard_rw 1970-01-16 20:51 Notifications
drwxrwxr-x root sdcard_rw 2012-11-19 12:06 Pictures
drwxrwxr-x root sdcard_rw 1970-01-16 20:51 Podcasts
drwxrwxr-x root sdcard_rw 2012-11-19 13:22 Ringtones
drwxrwxr-x root sdcard_rw 2012-11-19 14:33 bluetooth
-rw-rw-r-- root sdcard_rw 79 2012-12-05 22:26 customerQueryRequest.xml
drwxrwxr-x root sdcard_rw 2012-11-20 02:50 data
-rw-rw-r-- root sdcard_rw 11394 2012-11-19 13:54 eightpen_custom_gestures
drwxrwxr-x root sdcard_rw 2012-11-19 13:17 media

我的 Nexus 4 怎么了?为什么它对 Windows 隐藏我的东西?

最佳答案

好像是 known issue affecting Android USB file access over MTP .在手机重启之前,MTP 缓存会过期。

一个 workaround是:

  • 清除“媒体存储”应用的数据
  • 使用 SDrescanSD Scanner (也适用于 Android 4.4/5,在 F-Droid 上可用)应用强制更新

或者干脆避免使用 USB。该问题不会影响访问文件的其他方法。例如,尝试 AirDroid传输文件。


注意:这不适用于 Android 5.0.2:清除“媒体存储”并使用 SD Rescanner 后,这些文件夹在 Windows 7 中显示为无法打开的 4K 文件。此时唯一的解决方案是再次清除媒体存储并重新启动设备

关于android - Nexus 4 未通过 MTP 显示文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13737261/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com