- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我有一台阿尔卡特 One Touch 7040,当我在上面测试我的 osmdroid 样本时, map 无法呈现。我在其他设备上测试过, map 在其中正确渲染,只有在这个设备上他们没有。我以为我的设备内存不足,所以我从设备中删除了一些应用程序,但仍然没有任何改善,有人可以告诉我可能是什么原因吗?
以下是我的logcat(由于超出字数限制,部分内容已被删除):
10-17 23:03:27.688 26424-26424/marine.com.osmsample I/OsmDroid: Using tile source: Mapnik
10-17 23:03:27.702 26424-26424/marine.com.osmsample E/OsmDroid: unable to create a nomedia file. downloaded tiles may be visible to the gallery. open failed: ENOENT (No such file or directory)
10-17 23:03:27.715 26424-26424/marine.com.osmsample E/SQLiteLog: (14) cannot open file at line 30202 of [00bb9c9ce4]
10-17 23:03:27.715 26424-26424/marine.com.osmsample E/SQLiteLog: (14) os_unix.c:30202: (2) open(/storage/sdcard0/osmdroid/tiles/cache.db) -
10-17 23:03:27.729 26424-26424/marine.com.osmsample E/SQLiteDatabase: Failed to open database '/storage/sdcard0/osmdroid/tiles/cache.db'.
android.database.sqlite.SQLiteCantOpenDatabaseException: unknown error (code 14): Could not open database
at android.database.sqlite.SQLiteConnection.nativeOpen(Native Method)
at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:209)
at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:193)
at android.database.sqlite.SQLiteConnectionPool.openConnectionLocked(SQLiteConnectionPool.java:463)
at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:185)
at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:177)
at android.database.sqlite.SQLiteDatabase.openInner(SQLiteDatabase.java:804)
at android.database.sqlite.SQLiteDatabase.open(SQLiteDatabase.java:789)
at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:694)
at android.database.sqlite.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:709)
at android.database.sqlite.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:702)
at org.osmdroid.tileprovider.modules.SqlTileWriter.<init>(SqlTileWriter.java:44)
at org.osmdroid.tileprovider.MapTileProviderBasic.<init>(MapTileProviderBasic.java:76)
at org.osmdroid.tileprovider.MapTileProviderBasic.<init>(MapTileProviderBasic.java:50)
at org.osmdroid.views.MapView.<init>(MapView.java:170)
at org.osmdroid.views.MapView.<init>(MapView.java:200)
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
at android.view.LayoutInflater.createView(LayoutInflater.java:587)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:687)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:285)
at android.app.Activity.setContentView(Activity.java:1882)
at marine.com.osmsample.MainActivity.onCreate(MainActivity.java:55)
at android.app.Activity.performCreate(Activity.java:5121)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1146)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2358)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2446)
at android.app.ActivityThread.access$600(ActivityThread.java:165)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1373)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:194)
at android.app.ActivityThread.main(ActivityThread.java:5434)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:834)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
at dalvik.system.NativeStart.main(Native Method)
10-17 23:03:27.731 26424-26424/marine.com.osmsample E/OsmDroid: Unable to start the sqlite tile writer. Check external storage availability.
android.database.sqlite.SQLiteCantOpenDatabaseException: unknown error (code 14): Could not open database
at android.database.sqlite.SQLiteConnection.nativeOpen(Native Method)
at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:209)
at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:193)
at android.database.sqlite.SQLiteConnectionPool.openConnectionLocked(SQLiteConnectionPool.java:463)
at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:185)
at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:177)
at android.database.sqlite.SQLiteDatabase.openInner(SQLiteDatabase.java:804)
at android.database.sqlite.SQLiteDatabase.open(SQLiteDatabase.java:789)
at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:694)
at android.database.sqlite.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:709)
at android.database.sqlite.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:702)
at org.osmdroid.tileprovider.modules.SqlTileWriter.<init>(SqlTileWriter.java:44)
at org.osmdroid.tileprovider.MapTileProviderBasic.<init>(MapTileProviderBasic.java:76)
at org.osmdroid.tileprovider.MapTileProviderBasic.<init>(MapTileProviderBasic.java:50)
at org.osmdroid.views.MapView.<init>(MapView.java:170)
at org.osmdroid.views.MapView.<init>(MapView.java:200)
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
at android.view.LayoutInflater.createView(LayoutInflater.java:587)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:687)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:285)
at android.app.Activity.setContentView(Activity.java:1882)
at marine.com.osmsample.MainActivity.onCreate(MainActivity.java:55)
at android.app.Activity.performCreate(Activity.java:5121)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1146)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2358)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2446)
at android.app.ActivityThread.access$600(ActivityThread.java:165)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1373)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:194)
at android.app.ActivityThread.main(ActivityThread.java:5434)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:834)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
at dalvik.system.NativeStart.main(Native Method)
10-17 23:03:27.732 26424-26424/marine.com.osmsample D/dalvikvm: create interp thread : stack size=128KB
10-17 23:03:27.732 26424-26424/marine.com.osmsample D/dalvikvm: create new thread
10-17 23:03:27.732 26424-26424/marine.com.osmsample D/dalvikvm: new thread created
10-17 23:03:27.732 26424-26424/marine.com.osmsample D/dalvikvm: update thread list
10-17 23:03:27.732 26424-26944/marine.com.osmsample D/dalvikvm: threadid=17: interp stack at 0x5f42b000
10-17 23:03:27.732 26424-26944/marine.com.osmsample D/dalvikvm: threadid=17: created from interp
10-17 23:03:27.732 26424-26424/marine.com.osmsample D/dalvikvm: start new thread
10-17 23:03:27.733 26424-26944/marine.com.osmsample D/dalvikvm: threadid=17: notify debugger
10-17 23:03:27.733 26424-26944/marine.com.osmsample D/dalvikvm: threadid=17 (Thread-2646): calling run()
10-17 23:03:27.733 26424-26944/marine.com.osmsample D/dalvikvm: threadid=17: exiting
10-17 23:03:27.733 26424-26944/marine.com.osmsample D/dalvikvm: threadid=17: bye!
10-17 23:03:27.739 26424-26424/marine.com.osmsample I/OsmDroid: sdcard state: mounted
10-17 23:03:27.745 26424-26424/marine.com.osmsample I/OsmDroid: sdcard state: mounted
10-17 23:03:27.746 26424-26424/marine.com.osmsample E/SQLiteLog: (14) cannot open file at line 30202 of [00bb9c9ce4]
10-17 23:03:27.746 26424-26424/marine.com.osmsample E/SQLiteLog: (14) os_unix.c:30202: (2) open(/storage/sdcard0/osmdroid/tiles/cache.db) -
10-17 23:03:27.749 26424-26424/marine.com.osmsample E/SQLiteDatabase: Failed to open database '/storage/sdcard0/osmdroid/tiles/cache.db'.
android.database.sqlite.SQLiteCantOpenDatabaseException: unknown error (code 14): Could not open database
at android.database.sqlite.SQLiteConnection.nativeOpen(Native Method)
at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:209)
at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:193)
at android.database.sqlite.SQLiteConnectionPool.openConnectionLocked(SQLiteConnectionPool.java:463)
at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:185)
at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:177)
at android.database.sqlite.SQLiteDatabase.openInner(SQLiteDatabase.java:804)
at android.database.sqlite.SQLiteDatabase.open(SQLiteDatabase.java:789)
at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:694)
at android.database.sqlite.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:709)
at android.database.sqlite.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:702)
at org.osmdroid.tileprovider.modules.SqlTileWriter.<init>(SqlTileWriter.java:44)
at org.osmdroid.tileprovider.modules.MapTileSqlCacheProvider.<init>(MapTileSqlCacheProvider.java:57)
at org.osmdroid.tileprovider.modules.MapTileSqlCacheProvider.<init>(MapTileSqlCacheProvider.java:63)
at org.osmdroid.tileprovider.MapTileProviderBasic.<init>(MapTileProviderBasic.java:88)
at org.osmdroid.tileprovider.MapTileProviderBasic.<init>(MapTileProviderBasic.java:50)
at org.osmdroid.views.MapView.<init>(MapView.java:170)
at org.osmdroid.views.MapView.<init>(MapView.java:200)
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
at android.view.LayoutInflater.createView(LayoutInflater.java:587)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:687)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:285)
at android.app.Activity.setContentView(Activity.java:1882)
at marine.com.osmsample.MainActivity.onCreate(MainActivity.java:55)
at android.app.Activity.performCreate(Activity.java:5121)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1146)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2358)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2446)
at android.app.ActivityThread.access$600(ActivityThread.java:165)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1373)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:194)
at android.app.ActivityThread.main(ActivityThread.java:5434)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:834)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
at dalvik.system.NativeStart.main(Native Method)
10-17 23:03:27.753 26424-26424/marine.com.osmsample E/OsmDroid: Unable to start the sqlite tile writer. Check external storage availability.
android.database.sqlite.SQLiteCantOpenDatabaseException: unknown error (code 14): Could not open database
at android.database.sqlite.SQLiteConnection.nativeOpen(Native Method)
at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:209)
at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:193)
at android.database.sqlite.SQLiteConnectionPool.openConnectionLocked(SQLiteConnectionPool.java:463)
at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:185)
at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:177)
at android.database.sqlite.SQLiteDatabase.openInner(SQLiteDatabase.java:804)
at android.database.sqlite.SQLiteDatabase.open(SQLiteDatabase.java:789)
at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:694)
at android.database.sqlite.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:709)
at android.database.sqlite.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:702)
at org.osmdroid.tileprovider.modules.SqlTileWriter.<init>(SqlTileWriter.java:44)
at org.osmdroid.tileprovider.modules.MapTileSqlCacheProvider.<init>(MapTileSqlCacheProvider.java:57)
at org.osmdroid.tileprovider.modules.MapTileSqlCacheProvider.<init>(MapTileSqlCacheProvider.java:63)
at org.osmdroid.tileprovider.MapTileProviderBasic.<init>(MapTileProviderBasic.java:88)
at org.osmdroid.tileprovider.MapTileProviderBasic.<init>(MapTileProviderBasic.java:50)
at org.osmdroid.views.MapView.<init>(MapView.java:170)
at org.osmdroid.views.MapView.<init>(MapView.java:200)
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
at android.view.LayoutInflater.createView(LayoutInflater.java:587)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:687)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:285)
at android.app.Activity.setContentView(Activity.java:1882)
at marine.com.osmsample.MainActivity.onCreate(MainActivity.java:55)
at android.app.Activity.performCreate(Activity.java:5121)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1146)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2358)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2446)
at android.app.ActivityThread.access$600(ActivityThread.java:165)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1373)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:194)
at android.app.ActivityThread.main(ActivityThread.java:5434)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:834)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
at dalvik.system.NativeStart.main(Native Method)
10-17 23:03:39.774 26424-27015/marine.com.osmsample D/OsmDroid: Unable to store cached tile from Mapnik /14/9291/6359, database not available.
10-17 23:03:39.792 26424-27015/marine.com.osmsample I/System.out: [CDS]rx timeout:0
10-17 23:03:39.819 26424-27003/marine.com.osmsample D/OsmDroid: Unable to store cached tile from Mapnik /14/9292/6359, database not available.
10-17 23:03:39.823 26424-27003/marine.com.osmsample I/System.out: [CDS]rx timeout:0
10-17 23:03:39.846 26424-27015/marine.com.osmsample D/OsmDroid: Unable to store cached tile from Mapnik /14/9290/6359, database not available.
10-17 23:03:39.852 26424-27015/marine.com.osmsample I/System.out: [CDS]rx timeout:0
最佳答案
设备的 API 级别是什么?这可能是权限问题。有时 android 也会将 Environment.getExternalStorageDir()
挂载为只读,这是错误的。总有一天我会通过变通办法来解决这个问题。
osmdroid 提供的示例应用程序是否有效?你不仅要启动它,你还得放大一点。示例应用附带了一些缓存的磁贴。
查看堆栈跟踪,Environment.getExternalStorageDir()
正在返回一个只读挂载点。因此,唯一合理的解决方案是告诉 osmdroid 在该类型的设备上使用不同的缓存位置。它可以很容易地完成,但必须在创建 map View 之前完成。此链接包含使用 osmdroid 进行的 API 调用
Using osmdroid without getting access to external storage
这个答案https://stackoverflow.com/a/15612964/1203182有一些很棒的代码可以返回可写的挂载点/路径列表。提示用户询问缓存存储位置可能是个好主意
编辑:在 osmdroid 5.6 中添加,添加了我讨论的解决方法,以及示例应用程序“打开 map ”中的示例,向您展示如何使用它。 osmdroid 5.6 及以上版本的默认缓存位置是最大的可写存储分区。然后这将被保存为首选项(再次参见示例应用程序)
关于android - Osmdroid map 未加载到我的设备上,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40100080/
我正在尝试在 android.support.v4.app.Fragment 中使用 OSMdroid 的离线模式。我的图 block 是由 MOBAC 使用“OSMdroid Zip”格式在地球坐标
我一直在尝试从 osmdroid 上的地理服务器获取 WMS 瓷砖。但到目前为止还没有成功。我只是设法获得一个位于其他位置的小型版 block 地理服务器。是的,投影是正确的,因为我也在我的 Web
我有一个使用 osmdroid-android-4.1 的现有 android 应用程序。 现在我想使用新的 osmdroid-android-4.2。因此,我已将 JAR 文件(osm-androi
我尝试在我的一个应用程序中使用 OSMdroid,但我得到了这个: 运行在硬件设备Android 4.0.3 (CM9) 从 logcat 记录: 06-25 16:56:07.389: E/Andr
我的应用程序有问题,其中包括 osmdroid。每次我尝试在我的设备上运行该应用程序并触摸 map 时,该应用程序都会崩溃,并且出现此错误: 2018-10-02 14:11:45.191 1
////OSMdroid 以标记为中心//// 我添加了标记,我需要以所有标记都可见的方式映射最大的增加或减少 我的代码: public class mapcode extends Activity
我试图放置用户代理(参见 https://github.com/osmdroid/osmdroid/wiki/Important-notes-on-using-osmdroid-in-your-app
大家下午好,如何为我从文件中读取的每个点在 map 上创建或插入新的叠加层?为了阅读这些要点,我创建了一个实现FolderOverlay 的类。下面是我的项目的代码:. GeoOverlay.java
我正在使用 Android Studio 用 Java 编写一个应用程序。我已经使用 osmdroid 显示了 map ,添加了一些叠加层以在特殊位置显示标记,并向标记添加了标题和描述。 现在,我
我正在使用 Osmdroid 库来显示离线 map ,并使用折线在 map 上绘制线条。但结果线不是连续的。如果街道是弯曲的,那么这条线就断了。 我的代码: Polyline polyline
我正在使用 osmdroid,并且已将 MyLocationNewOverlay 添加到我的 map 中以显示我当前的位置。这看起来不错。我想要的是一个按钮,可以将 map 置于我当前位置的中心,类似
所以我想制作一个 CheckBoxPreference 来打开 osmdroid 中的夜间模式。但是代码没有任何作用。我在没有 PreferenceScreen 的情况下做了同样的事情,一个带有开关的
我需要有关 osmdroid 功能的代码的帮助,当我点击标记时,它不会返回标题和描述 谁能帮我...这是我的 代码 import java.util.ArrayList; import org.osm
我必须使用 osmdriod map api 实现导航。该 Activity 使用以下接收器从位置服务接收广播: public class ReceiveMessages extends Broadc
我正在尝试为 osmdroid 构建自定义缩放控件。我创建按钮并使用放大方法,如图所示 here但是当我点击按钮时没有任何反应。这是我的代码: private MapView map; @Overri
我在我的应用程序中使用 osmdroid 3.0.5 jar 来显示 map View 。我正在叠加一个由水平线和垂直线组成的叠加层。我注意到只有在某些位置,在高缩放级别时,一些线条会消失,然后在拖动
我有一个使用 OSMDroid 的项目。有一个绘制标记的循环,结束之后我必须将 map 居中放置在某个标记处。我的代码: //I have on open Cursor c Marker switch
我正在使用 OSMDroid,我有一组地理点,然后我创建了一条折线,如下所示: private void drawPolyline(ArrayList polyline) { Polyline
我正在使用 osmdroid 库来渲染 map 。我有两个间歇性变化的地理点,并希望 org.osmdroid.views.MapView 调整大小和转换以确保两个点始终可见。我可以轻松地将 map
1) 我可以使用不同的自定义标记吗? 我需要一个用于用户的位置,一个用于所有其他项目。 编辑:是的,你可以。 2) 我可以在标记中添加图像吗? 我需要为每个标记分配一个不同的图像(我将从数据库中获得)
我是一名优秀的程序员,十分优秀!