Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BingMapTileSource always crash #1986

Open
sby5388 opened this issue Mar 8, 2024 · 2 comments
Open

BingMapTileSource always crash #1986

sby5388 opened this issue Mar 8, 2024 · 2 comments

Comments

@sby5388
Copy link

sby5388 commented Mar 8, 2024

Please note: issues related to or caused by osmbonuspack will be closed with a
suggestion to open an issue at https://github.com/MKergall/osmbonuspack

(feel free to delete whatever doesn't apply)

Issue Type

[ ] Bug

Description and/or steps/code to reproduce the problem

as you know ,in China ,I can't use bingMap direct, so i use vpn
if the network is unavailable (like i don't open vpn-app), the osmdroid with bingmap work even it could not show bing-map-tile well ,just display old cached;
but when I enable vpn-app, it work well just 20-seconds and crash,this not happened in all devices;
these are crash log

java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.String.length()' on a null object reference
 at java.util.Formatter.parse(Formatter.java:2546)
 at java.util.Formatter.format(Formatter.java:2505)
 at java.util.Formatter.format(Formatter.java:2459)
 at java.lang.String.format(String.java:2870) 
at org.osmdroid.tileprovider.tilesource.bing.BingMapTileSource.getTileURLString(BingMapTileSource.java:124)
at org.osmdroid.tileprovider.modules.MapTileDownloader$TileLoader.loadTile(MapTileDownloader.java:188)
at org.osmdroid.tileprovider.modules.MapTileModuleProviderBase$TileLoader.loadTileIfReachable(MapTileModuleProviderBase.java:213)
at org.osmdroid.tileprovider.MapTilePreCache.search(MapTilePreCache.java:127)
at org.osmdroid.tileprovider.MapTilePreCache.access$100(MapTilePreCache.java:31)
at org.osmdroid.tileprovider.MapTilePreCache$1.run(MapTilePreCache.java:42)
at org.osmdroid.util.GarbageCollector$1.run(GarbageCollector.java:32)
                                                            
@Override
public String getTileURLString(final long pMapTileIndex) {
    if (!mImageryData.m_isInitialised) {
        initMetaData();
    }
    return String.format(mUrl, quadTree(pMapTileIndex));
}

the NPE happened at 3rd-lib && java-framework in thread ,so I can't caught it;
so why and what should i do to handle it or avoid app-crash ?

Environment

android 11
org.osmdroid:osmdroid-android:6.1.11@aar

If it's a bug, version(s) of android this affects:

android-api-30
abdroid-version:11

Version of osmdroid the issue relates to:

6.1.11

@spyhunter99
Copy link
Collaborator

it calls the function BingMapTileSource#initMetaData which attempts to fetch data from
https://dev.virtualearth.net/REST/V1/Imagery/Metadata/%s?mapVersion=v1&output=json&uriScheme=https&key=%s
defaulting to the road imagery set using your bing map key.

The bing map key can set via a variety of mechanisms.

it's also entirely possible that bind has updated how map tiles work and that none of this works anymore. may need to consult their documentation on map tile access.

@sby5388
Copy link
Author

sby5388 commented Mar 18, 2024

它调用函数 BingMapTileSource#initMetaData 尝试从 https://dev.virtualearth.net/REST/V1/Imagery/Metadata/%s?mapVersion=v1&output=json&uriScheme=https&key=%s获取数据 ,默认为道路图像集使用您的 bing 地图密钥。

bing 地图密钥可以通过多种机制进行设置。

也完全有可能,bind 更新了地图图块的工作方式,而这些都不再起作用了。可能需要查阅有关地图图块访问的文档。


thanks.it wotk

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants