简体   繁体   English

eclipse + adt连接到真实的移动设备时,应用无法访问sdcard

[英]App can not access sdcard when eclipse+adt connect to real mobile device

When eclipse+adt connect to an avd emulator, my app run well and it will read/write the sdcard in this avd emulator. 当eclipse + adt连接到avd模拟器时,我的应用程序运行良好,它将在此avd模拟器中读取/写入sdcard。

Now I connect eclipse+adt to a real device by USB. 现在,我通过USB将eclipse + adt连接到真实设备。 Eclipse+adt transfre app to the real device and app run successful. 将Eclipse + adt Transfre应用程序迁移到真实设备,并且该应用程序成功运行。 But, when app access sdcard, it failed. 但是,当应用程序访问SD卡时,它失败了。 When I disconnect USB, app can access sdcard. 当我断开USB连接时,应用程序可以访问sdcard。 Of course, I can't get the log out. 当然,我无法注销。

What shall I do? 我该怎么办? I want debug app on real device and it read/write sdcard and I want the log out. 我想在真实设备上调试应用程序,并且它读/写sdcard,我想注销。

Addition, when I connect USB, device system give a hint: can't visit sdcard memory. 另外,当我连接USB时,设备系统会提示:无法访问sdcard内存。

To access the sd card of a phone, we need to root the phone. 要访问手机的sd卡​​,我们需要启动手机。 Once you root a device, you can even see the database of the aplication that you are developing. 一旦为设备建立了根目录,您甚至可以查看正在开发的应用程序的数据库。

finally I find the way. 终于我找到了路。 When USB connect to PC, I should set the connection as "only battery charge", then both eclipse and app on this mobile can visit SD card. 当USB连接到PC时,我应该将连接设置为“仅电池充电”,然后该移动设备上的eclipse和app都可以访问SD卡。 The total setting about USB connection type include: 1, ask when connection, 2, only battery charge, 3, open memory card. USB连接类型的总设置包括:1,连接时询问,2,仅电池充电,3,打开存储卡。 I choose the second. 我选择第二个。 I try this in my mobile phone of "xiaomi" which is famous brand of a China company. 我在中国公司的知名品牌“小米”手机中尝试了这一操作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM