尝试显示 OpenStreetMap 地图时出现文件存储错误

File storage error when trying to display an OpenStreetMap map

我的 Android 使用 OpenStreetMap 的应用程序已经运行了几个月,但现在无法再显示 OpenStreetMap 地图。尽管授予了 WRITE_EXTERNAL_STORAGE 权限,我还是收到了这样的消息:

E/OsmDroid: Unable to start the SQLite tile writer. Check external storage availability.
I/StorageUtils: /storage/emulated/0 is NOT writable

由于我在 Android 10 phone 上针对 API29 和 运行,我想问题与有关外部存储访问的新政策和使用存储访问框架。我说的对吗?

不管我是对还是错,有谁知道我该如何解决这个问题?

因为您的目标是 Andorid 10 - api 29,官方 Android 文档指出:

Running on Android 10

If your app targets Android 10 (API level 29), opt-out of scoped storage and continue using the approach for Android 9 and lower to perform this operation.

所以你需要添加到AndroidManifest.xml:

<manifest ... >
<!-- This attribute is "false" by default on apps targeting
   Android 10 or higher. -->
    <application android:requestLegacyExternalStorage="true" ... >
     ...
    </application>
</manifest>

@blackapps 这不是黑客。