【问题标题】:Android emulator sdcard permissionsAndroid 模拟器 sdcard 权限
【发布时间】:2016-12-12 15:35:17
【问题描述】:

我正在使用 eclipse 并试图让 android 模拟器让我写入 sdcard。

当我在手机上安装该应用程序时,它会提示接受所需的权限...并且该程序可以运行。当我尝试使用模拟器测试应用程序时,我没有收到提示,并且使用该程序导致权限被拒绝。

我已尝试重新创建我的 avd... 并将 sdcard 大小设置为 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>

那么如何让模拟器授予我写入 sdcard 的权限?我所做的可以在手机上运行……那为什么不在模拟器中呢?

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

在 Eclipse DDMS 透视图中查看权限,它们是 d---------

编辑:我让它工作了。

我不得不从 avd 管理器手动启动模拟器。当你点击运行时让eclipse启动模拟器似乎会使某些东西短路。

【问题讨论】:

    标签: android permissions emulation sd-card


    【解决方案1】:

    打开 AVD 管理器,选择合适的模拟器,然后从右侧面板中选择 编辑。

    然后在硬件选项上,你会看到很多属性,现在,点击New按钮,选择SD card support,点击Ok.

    现在您可以在模拟器中使用您的 SD 卡了。

    【讨论】:

      【解决方案2】:

      在 Android 6 和 Emulator 中,我们需要通过 Setting &gt; Apps 选择您要授予权限的应用程序,然后像这样授予权限:

      分享给遇到这个问题的人(我用的是android studio)

      【讨论】:

        【解决方案3】:

        我在使用 Gingerbread 模拟器时遇到了很多问题......出于某种原因,即使清单权限已到位,模拟器也根本不允许访问。

        解决方案:

        访问 android shell(即 adb shell)并输入:

        mount -o remount,rw /sdcard

        【讨论】:

          【解决方案4】:

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

          【讨论】:

          • 我已经尝试重新创建我的 avd... 并将 sdcard 大小设置为 4Gb。
          猜你喜欢
          • 2012-10-09
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2011-09-28
          • 2011-11-17
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多