我正在使用Eclipse尝试让Android模拟器允许我写入SD卡。当我在手机上安装应用程序时,它会提示我接受所需的权限...然后程序就可以运行了。但是,当我尝试使用模拟器测试应用程序时,我没有得到提示,并且使用该程序会导致权限被拒绝。我已经尝试重新创建AVD...并将SD卡大小设置为4GB。显然,我在AndroidManifest.xml文件中有uses permission行...下面是它:
那么,我该如何让模拟器给我写入sdcard的权限?我的操作在手机上有效...为什么模拟器不行呢?
刚才在模拟器中的开发工具终端中尝试导航到sdcard...提示权限被拒绝。
在Eclipse DDMS透视图中查看权限,它们是d---------。
编辑:我搞定了。
我必须手动从avd管理器启动模拟器。让eclipse在运行时启动模拟器似乎会短路某些东西。
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="j**.B********.App"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="10" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application android:icon="@drawable/icon" android:label="@string/app_name" android:permission="android.permission.WRITE_EXTERNAL_STORAGE">
<activity android:name=".NotesActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
那么,我该如何让模拟器给我写入sdcard的权限?我的操作在手机上有效...为什么模拟器不行呢?
刚才在模拟器中的开发工具终端中尝试导航到sdcard...提示权限被拒绝。
在Eclipse DDMS透视图中查看权限,它们是d---------。
编辑:我搞定了。
我必须手动从avd管理器启动模拟器。让eclipse在运行时启动模拟器似乎会短路某些东西。