尝试使用 eclipse 将文件推送到 android 设备的问题
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10671987/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Problems trying to push files into android device using eclipse
提问by Ryuujin
I'm currently using Samsung Galaxy S2 i1900G
to try to test my application but apparently I need to push a database file in order for my application to connect to it and work. But it would seem that every time I try to push a file into the device I would get an error.
我目前正在Samsung Galaxy S2 i1900G
尝试测试我的应用程序,但显然我需要推送一个数据库文件,以便我的应用程序连接到它并工作。但似乎每次我尝试将文件推送到设备时,我都会收到错误消息。
Here's the error I keep getting
这是我不断收到的错误
[2012-05-20 16:16:26 - ddms] transfer error: Read-only file system
[2012-05-20 16:16:56] Failed to push selection: Read-only file system
I can't seem to figure out what the problem is. Will it make any difference if I were to root my phone? And is it possible to root Samsung Galaxy S2 i1900G model for now? Hope you guys can help me out.
我似乎无法弄清楚问题是什么。如果我要root我的手机会有什么不同吗?现在是否可以根植三星 Galaxy S2 i1900G 型号?希望大家能帮帮我。
回答by rinkesh
Here is the solution
这是解决方案
- Open Android Virtual device manager
- select your emulator
- edit your emulator
- must specified size of your sd card 1024MB
- in hardware option click new set property add sd card support: yes(value)
- start your emulator, in eclipse window-->showview-->other->android-->file explorer
- ->in file explorer open mnt->sdcard and using pushfile button for insert your file and image
- DONE
- 打开 Android 虚拟设备管理器
- 选择你的模拟器
- 编辑你的模拟器
- 必须指定您的 SD 卡大小 1024MB
- 在硬件选项中单击新设置属性添加 SD 卡支持:是(值)
- 启动你的模拟器,在eclipse窗口-->showview-->other->android-->file explorer
- -> 在文件资源管理器中打开 mnt->sdcard 并使用 pushfile 按钮插入文件和图像
- 完毕
回答by Tarun
You can try adb shell mount -o remount,rw /data
to remount /data as rw
您可以尝试adb shell mount -o remount,rw /data
将 /data 重新挂载为 rw
回答by Rajesh J Advani
If your application needs to access a database, you don't need to copy one to the phone. And in any case, if you were to root the phone and force it on, this type of application would only work on your specific phone.
如果您的应用程序需要访问数据库,则无需将其复制到手机中。无论如何,如果您要根植手机并强制开启,这种类型的应用程序只能在您的特定手机上运行。
This article here - http://www.vogella.com/articles/AndroidSQLite/article.html- explains how to use an SQLite database with Android applications. You should just use the built-in API to create the database from your application if it doesn't already exist.
此处的这篇文章 - http://www.vogella.com/articles/AndroidSQLite/article.html- 解释了如何在 Android 应用程序中使用 SQLite 数据库。如果数据库不存在,您应该只使用内置 API 从您的应用程序创建数据库。
回答by IncrediApp
This is probably since your device is connected in USB storage mode which means your SD card is mounted... You have to connect your device in a different mode in order for adb to be able to push files
这可能是因为您的设备以 USB 存储模式连接,这意味着您的 SD 卡已安装...您必须以不同的模式连接您的设备,以便 adb 能够推送文件
回答by user2040720
Even if it is working you won't be able to push to all dirs and it may look like you have a problem when you don't.
即使它正在工作,您也无法推送到所有目录,而且如果不这样做,您可能看起来有问题。
In the DDMS Perspective , file explorer tab select the sdcard directory and try a push - it should go - you can only push to rw dirs and some are read only. If you can do this then you just need to make sure the dir you are using is rw - which is shown in the permissions tab of the same view.
在 DDMS Perspective 中,文件资源管理器选项卡选择 sdcard 目录并尝试推送 - 它应该去 - 您只能推送到 rw 目录,有些是只读的。如果您可以这样做,那么您只需要确保您使用的目录是 rw - 它显示在同一视图的权限选项卡中。