Change file permissions in DDMS (Android)(在 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
无论如何都要小心,仅将 /data
或 sdcard
等可写文件系统用于您的应用程序数据,因为使用受限文件夹可能会在生产环境中产生负面影响!
Be careful in anyway to use only writable filesystems like /data
or sdcard
for your application data since using restricted folders can have negative side effects in a productive environment!
这篇关于在 DDMS (Android) 中更改文件权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:在 DDMS (Android) 中更改文件权限


- 将log4j 1.2配置转换为log4j 2配置 2022-01-01
- Java包名称中单词分隔符的约定是什么? 2022-01-01
- Jersey REST 客户端:发布多部分数据 2022-01-01
- Eclipse 插件更新错误日志在哪里? 2022-01-01
- 从 finally 块返回时 Java 的奇怪行为 2022-01-01
- value & 是什么意思?0xff 在 Java 中做什么? 2022-01-01
- 如何使用WebFilter实现授权头检查 2022-01-01
- Spring Boot连接到使用仲裁器运行的MongoDB副本集 2022-01-01
- Safepoint+stats 日志,输出 JDK12 中没有 vmop 操作 2022-01-01
- C++ 和 Java 进程之间的共享内存 2022-01-01