2011-07-06 65 views
2

我使用eclipse并试图让android模拟器让我写入SD卡。Android模拟器sdcard权限

当我在手机上安装应用程序时,它会提示接受所需的权限...并且该程序正常工作。当我尝试使用模拟器来测试应用程序时,我没有收到提示,并且使用程序结果拒绝了权限。

我试过重新创建我的AVD并将SD卡大小设置为4Gb。 很显然,我必须在AndroidManifest.xml ... 的使用许可行,那就是:

<?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> 

那么,如何让模拟器给我写信给SD卡的权限?我所做的工作在手机上...为什么不在模拟器中?

刚才在模拟器的开发工具终端中,我尝试导航到sdcard ...权限被拒绝。

望着在Eclipse DDMS角度来看权限,他们是d ---------

编辑:我得到它的工作。我不得不从AVD管理器手动启动模拟器。当你点击运行时,让eclipse启动模拟器似乎会让某些东西短路。

回答

0

只是猜测 - 但也许你已经配置了模拟器0外部存储?

+0

我试着重新创建我的avd ...并将sdcard大小设置为4Gb。 – user832541

2

我得到这个问题很多与姜饼模拟器...由于某些原因,模拟器根本不允许访问,即使清单许可已到位。

解决方案:

访问机器人壳(即ADB壳)和输入:

安装邻重新装载,RW/SD卡

4

打开AVD管理器,选择相应的模拟器,并从右侧面板中选择编辑

然后在硬件选项,你会看到许多特性,现在,点击新建按钮,并选择支持SD卡,单击确定

现在你可以在模拟器内使用你的SD卡。

2

在Android中6,和仿真器,我们需要隆重许可手册由 Setting > Apps 选择了要授予权限应用程序,然后准许这样的:

enter image description here

分享的人面对这个问题, (我使用Android工作室)