在 DDMS (Android) 中更改文件权限 [英] Change file permissions in DDMS (Android)

查看:24
本文介绍了在 DDMS (Android) 中更改文件权限的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试测试我的应用程序由于缺少权限而无法访问某些文件时的行为.

I'm trying to test the behavior of my application when it cannot access some files due to missing permissions.

是否可以在 DDMS 透视图中使用 FileExplorer 更改 Android 模拟器上的文件/文件夹权限?

Is it possible to change file/folder permissions on an android emulator using FileExplorer in DDMS perspective?

推荐答案

要更改模拟器中的权限,您需要使用您的 adroid-sdk 平台工具中的 adb shell 命令.在 android shell 中,您可以输入命令 su 以获取 root 访问权限.现在您可以使用普通的 unix 命令 chmod

To change permissions in the emulator you need to use the adb shell command from your adroid-sdk platform-tools. In the android shell you can enter the command su to get root access. Now you can see and change the permissions with the normal unix commands chmod

注意,Android中的系统文件夹是只读挂载的.在本教程之后,您必须将其以读写方式移除:

Note, that the system folder in Android is mounted read-only. You would have to remout it read-write after this tutorial:

http://android-tricks.blogspot.com/2009/01/mount-filesystem-read-write.html

无论如何都要小心,仅将 /datasdcard 等可写文件系统用于您的应用程序数据,因为使用受限文件夹可能会在生产环境中产生负面影响!

Be careful in anyway to use only writable filesystems like /data or sdcardfor your application data since using restricted folders can have negative side effects in a productive environment!

这篇关于在 DDMS (Android) 中更改文件权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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