我们如何切换MTP上​​更容易出现调试启用的Andr​​oid 6.0设备上? [英] How do we toggle on MTP more easily on a Debug-Enabled Android 6.0 device?

查看:1299
本文介绍了我们如何切换MTP上​​更容易出现调试启用的Andr​​oid 6.0设备上?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Android的6.0,<一个href=\"http://developer.android.com/about/versions/marshmallow/android-6.0-changes.html#behavior-usb\">MTP不再自动工作的:

In Android 6.0, MTP no longer works automatically:

设备连接现在默认设置为充电-only模式。要访问设备及其通过USB连接的内容,用户必须明确授予权限这种互动。如果您的应用支持与设备上的USB端口的用户交互,考虑到交互必须显式启用。

Device connections through the USB port are now set to charge-only mode by default. To access the device and its content over a USB connection, users must explicitly grant permission for such interactions. If your app supports user interactions with the device over a USB port, take into consideration that the interaction must be explicitly enabled.

MTP需要至少每您在插入USB电缆,可能更频繁地超过该时间重新授权(超时?)。

MTP needs to be re-authorized at least every time you plug in the USB cable, and possibly more frequently than that (timeouts?).

启用USB调试,我发现让MTP共享设备上工作的唯一的解决办法是:

With USB debugging enabled, the only solution that I have found to get MTP sharing to work on the device is to:


  • 走进设置>开发者选项

  • 向下滚动到选择USB配置

  • 该选项的值切换到任何的的MTP,如仅充电(如果是在MTP现在)

  • 该选项的值切换到MTP

  • 刷新MTP客户端(例如,在Ubuntu 15.04,关闭并重新打开显示设备中的内容的窗口)

  • Go into Settings > Developer options
  • Scroll down to "Select USB Configuration"
  • Switch the value of that option to anything but MTP, such as "Charging only" (if it is on MTP right now)
  • Switch the value of that option to MTP
  • Refresh your MTP client (e.g., on Ubuntu 15.04, close and re-open the window showing the contents of the device)

这是加剧的,当你试图用一个设备上的外部存储的文件进行操作。

This is aggravating when you are trying to work with a device's files on external storage.

是否有一个命令行的方式来获得MTP去,总之写UIAutomator测试,它可以自动上述过程的?或者说,有一些其他的方式来获得MTP在没有这种$ P $聚丙烯工艺的工作?

Is there a command-line way to get MTP going, short of writing a UIAutomator "test" that automates the above process? Or, is there some other way to get MTP to work without this sort of prep process?

推荐答案

我怀疑没有某种超能力的它不会是可能的: - (

I suspect it will not be possible without some sort of super power :-(

adb shell svc usb setFunction mtp

抛出 java.lang.SecurityException异常:无论是用户还是2000当前进程具有android.permission.MANAGE_USB MANAGE_USB 签名|特权许可。我提起这个作为问题#193062 。它已投入状态的分配的并标记为的缺陷25596495

throws java.lang.SecurityException: Neither user 2000 nor current process has android.permission.MANAGE_USB. and MANAGE_USB is a signature|privileged permission. I filed this as issue#193062. It has been put into state Assigned and labeled as Defect-25596495.

这篇关于我们如何切换MTP上​​更容易出现调试启用的Andr​​oid 6.0设备上?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆