`

Android Read-only file system 错误 /sdcard问题

 
阅读更多
http://longshuai2007.blog.163.com/blog/static/142094414201162793949787/


adb shell 后: mount -o remount rw(空格)/
到tools文件夹运行:adb  mount -o remount rw(空格)/



在程序中访问SDCard,你需要申请访问SDCard的权限。
在AndroidManifest.xml中加入访问SDCard的权限如下:
<!-- 在SDCard中创建与删除文件权限 -->
<uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS"/>
<!-- 往SDCard写入数据权限 -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>




-------------------------------更多关于sdcard问题-------------------------
为什么需要sdcard
在android 中网页中图片的下载都会自动向sdcard 寻找空间,sdcard在开发测试中也是非常之必要。


1:如何在模拟器中加载 sdcard
通过文档中介绍可得如下示例:
mksdcard -l sdcard 100M sdcard.img // 这样会在Tools的目录下产生 sdcard 在pc 中的镜像文件。
模拟器启动的时候加载sdcard
emulator -sdcard sdcard.img -avd myavd2(myavd2是模拟器名字,假如存在AVD403.ini,那应该是:emulator -sdcard sdcard.img -avd AVD403)
这样后模拟器就可以看到自己的sdcard,通过adb shell 可以登录查看。


2:遍历sdcard
如何找到android 中的些特殊路径呢 ,像sdcard这种特殊路径,其实只要看
android.os.Environment 这个类便很清晰了,其中有如下的方法:
getRootDirectory();
getDownloadCacheDirectory();
getExternalStorageDirectory();
getExternalStorageState(); 可以得到当前的sdcard 的各个状态。

有了文件的路径,就可以再用File进行各种遍历等操作了。
分享到:
评论

相关推荐

    openwrt-orangepi-zero-ext4-sdcard.img.gz

    Click Create a backup of uboot (dtb-file) Configure items to boot (wifi-xr819, Sunxi-IR, 1Wire (PA06 GPIO-6), i2c0, i2c1, pwm0, usb2-3 ..). Click Save changes. Click Apply changes, and reboot. Orange-...

    android调试sdcard文件加载,解决不能传入文件问题

    android调试sdcard文件加载,解决不能传入文件问题: 只需要执行4个命令,win和mac下都好使。

    Android代码-filer-old

    File system browser Manages Extension -&gt; Mimetype database. Create RUN shortcuts for file:// directories Create VIEW shortcuts file:// based on mimetype Handles Intents { action:RUN mimeType:text/...

    Android代码-jmdsp

    You'll need something that handles "org.openintents.action....android-sdk-XXX/tools/adb push yoursongfile.mid /sdcard Running the app: - Tap "Load" text to open an open file dialog. Pick a SMF file. -

    android读取sdcard路径下的文件的方法

    代码如下:// 读取sdcard文件private void sdcardRead(){String fileName = “/sdcard/my_sdcard.txt”;// assets下文件//String fileName = “/sdcard/test/my_sdcard_test.txt”;// sdcard下子目录文件String ret =...

    Android抓包和封包分析工具V1.0.1

    复制文件:cp 不成功可以使用 dd if=/sdcard/tcpdump of=/system/xbin/tcpdump 没有写权限:mount -o remount,rw / 和 mount -o remount,rw /system 参考代码: 手机抓包工具V2.0 pyhttpcap-master

    lunch_r58_20160906.7z

    wenyuanbo@cm-System-Product-Name:/home/wwt/lunch_cb5801_r58/android/device/softwinner/octopus-cb5801$ grep perf . -R 匹配到二进制文件 ./.git/index grep: ./.git/svn: 没有那个文件或目录 ./.git/config: ...

    lunch_cb5801_r58_20160907.7z

    wenyuanbo@cm-System-Product-Name:/home/wwt/lunch_cb5801_r58/android/device/softwinner/octopus-cb5801$ grep perf . -R 匹配到二进制文件 ./.git/index grep: ./.git/svn: 没有那个文件或目录 ./.git/config: ...

    Android抓包和封包分析工具V1.0.4

    复制文件:cp 不成功可以使用 dd if=/sdcard/tcpdump of=/system/xbin/tcpdump 没有写权限:mount -o remount,rw / 和 mount -o remount,rw /system 参考代码: 手机抓包工具V2.0 pyhttpcap-master

    android 网络 抓包工具和方法

    使用TCPdump工具,抓TCP数据包。...TCPdump下载地址http://www.strazzere.com/android/tcpdump Wireshark下载地址 http://www.wireshark.org/download.html 注意:其中需要使用"刷机精灵"来获取手机Root最高权限。

    Android开发入门教程.doc

    ----------------------------------- Android 编程基础应用 SDCard SDCard SDCard SDCard① 打开 CMD② 进入 C:\Documents and Settings\ 地狱怒兽 \Local Settings\Application Data\Android\SDK-1.1 目录③ 创建 ...

    lichee_20170502_1607_全志R16的linux系统编译需要改动的文件_使用parrotv1.1的内核_没有外层目录.7z

    rootroot@cm-System-Product-Name:/home/wwt/linux_r16$ tar zxvf lichee_parrotv1.1_20161202.tar.gz rootroot@cm-System-Product-Name:/home/wwt/linux_r16$ rootroot@cm-System-Product-Name:/home/wwt/linux_...

    tcpdump for android

    你需要root权限, ...# "-w": write packets to a file &#40;rather than printing to stdout&#41; ... do whatever you want to capture, then ^C to stop it ... 导出 adb pull /sdcard/capture.pcap .

    android网络抓包工具tcpdump

    你需要root权限, ...# “-w”: write packets to a file &#40;rather than printing to stdout&#41; … do whatever you want to capture, then ^C to stop it …导出 adb pull /sdcard/capture.pcap

    TX12-EdgeTx-elrs.zip

    包含资料: 1. bw128x64.zip // SD卡资料及格式 2. edgetx-cpn-win64-v2.7.1.zip //...5. edgetx-sdcard-sounds-en-2.7.0.zip //英文语音 6. elrsV2_251.lua // elrs V2.5.1 tag的elrs脚本(TX12上测试过可执行)

    Android数据存储之--SDCard

    Android数据存储之--SDCard的源代码

    linux全志R16的linux系统编译的资料_20170502_1655.7z

    libencode-locale-perl libfile-listing-perl libfont-afm-perl libhtml-form-perl libhtml-format-perl libhtml-parser-perl libhtml-tagset-perl libhtml-tree-perl libhttp-cookies-perl libhttp-daemon-perl ...

    Shamiko-v0.5.1-115-release-隐藏root.zip

    Shamiko-v0.5.1-115-release-隐藏root.zip

    android平台ntfs-3g移植源码,可直接mm编译

    android平台移植ntfs-3g使支持ntfs格式tf卡、U盘、stat硬盘挂载,解压文件到external目录下,mm编译成功后,可手动指行 ntfs-3g /dev/block/vold/* /storage/sdcard1 或者添加 Ntfs.cpp Ntfs.h到system/vold目录实现...

    基于tiny6410、USB摄像头、motion、curl的远程移动图像监测可执行文件及使用说明

    * @file readme.txt * @brief 基于tiny6410、USB摄像头、motion、curl的远程移动图像监测实现说明 * @details * @version V1.0.0 * @author Richard.hmm * @date 2014-2-9 */ 1、拷贝motion所需的动态库到...

Global site tag (gtag.js) - Google Analytics