【问题标题】:Need to get permissions to save image into my sdcard需要获得许可才能将图像保存到我的 SD 卡中
【发布时间】:2023-03-31 22:35:01
【问题描述】:

我创建了一个 android 应用程序,它从给定的 URL 下载图像并将其下载并保存到我的 sdcard 中。图像将保存到 /mnt/sdcard/TempImages 文件夹中。然后将图像加载到 imageview 中,以便在我的 android 活动中查看它。直到今天早上,应用程序工作得很好,但是从今天早上开始,当我尝试运行应用程序时,无法在我的活动中查看图像。我一直在从我自己的 Web 服务器加载图像,并且我已授予对服务器中文件的读取或写入访问权限的完全权限。所以从服务器端没有问题。问题出在客户端。这是尝试运行应用程序时的错误日志。我应该如何在 /mnt/sdcard/TempImages 文件夹中为我的应用程序添加读写权限。

W/System.err(458): java.io.FileNotFoundException: /mnt/sdcard/TempImages/-1267781495 (Permission denied)

【问题讨论】:

  • 发布你的代码和日志

标签: android image file-io file-permissions permission-denied


【解决方案1】:

在清单中添加 WRITE_EXTERNAL_STORAGE 权限

【讨论】:

    【解决方案2】:

    确保在应用清单中添加正确的权限

    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    

    【讨论】:

      【解决方案3】:

      Make sure your app has the proper permissions to be allowed to write to external storage:

      在清单文件中应该如下所示:

      <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2015-04-19
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多