-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Custom icon potentially causing crash on certain devices #3031
Comments
@danswick Hey Dan, thanks for the feedback. I just created a new project with the custom marker sample code but I couldn't reproduce your issue. I'd love to see if we could get some crash logs to investigate further. Could you re-rerun your sample code making sure this dropdown in Android Studio is set as "no-filters"? |
Thanks, @zugaldia. Remembered my USB-C cable today and here's the unfiltered log:
For good measure, I just tested on my 2013 Moto X running 5.1 and didn't get any errors. |
I got the same issue on Nexus7 OS 5.0.2. with
This is source code I used to make marker.
|
@vfaSonnt thanks for the feedback. It doesn't seem like you were using the assets in the sample page, may I ask which assets resolutions are you using in your sample code? |
@zugaldia thank for the reply. I think I found the problem.
But it can run on android os JELLY_BEAN
|
In my tests: |
I'm seeing the same issue on 2.2.0 with a 590x290 image on a device with scale of 3.5 3 pixels are lost in the height causing an exception on line 25. |
I have noticed this issue also, I created #3108, will close that one down in favor of this one: Referencing symbolicated stacktrace from that issue:
@zugaldia: here are the details to reproduce this issue:
LMK if you need extra 👀 on this |
Thanks for reporting this @vfaSonnt! @afathman @MrChaz can you confirm this too with your apps? If we can settle on this we can then move forward with a either a fix to ensure that width and height are always the same size and/or build out support for different sizes. |
Discussed with @1ec5 @friedbunny @jfirebaugh and this appears to be an issue with the common Core GL as it's impacting iOS too. Work is being done at that level to address an issue with integer / float conversions. |
Yea, it crashes whether or not the dimensions are the same or different. Can confirm the issue is with the integer/float conversion. |
I had the same issue! I found out that the image has to be 72x72! Try it out and replay. EDIT: I think you can use all parts of 72. 216x216 also works. |
+1 here |
The underlying issue is being addressed in #3164. |
+1 Notice this code in loadSprite function in MapView.java:
For certain devices sprite sizes such as 72x72 or 216x216 may work, but if some device has another DPI, this scaling may cause error described by @MrChaz. I've tested custom markers on 4 different devices and for every size work good on some devices and crash on another. To be honest, I doubt if the original markers work on all devices. Thanks! |
Hi @bleege , any idea when this fix will be released? Thanks. |
I was working on changes that would have fixed this (#3164 / branch here) but got pulled onto offline priorities. Someone else will need to take over. |
As @jfirebaugh reiterated this is an issue in Core GL (meaning it affects both iOS and Android) and is being addressed in #3164. In the interim, the recommended solution (on Android) is to use the square image assets (width x height) across the drawable density folders ( Also, please remember that Pull Requests are always welcomed. 😃 |
I meant to mention in my previous comment: it's probable that there's an alternate / quicker fix than #3164 / this branch here, which is a deeper code cleanup that would fix this almost as a side effect. |
Until this is sorted out in Core GL, it is recommended to follow Google's advice for scaling drawables:
|
@ansis I will take that up, I have locally a setup ready that used to crash |
@tobrun thanks, based on @1ec5's test it'll probably crash #2198 (comment) |
That crashlog suggests that one of these validations is failing. That would indicate that this is a problem in the bindings:
|
this is fixed by #3561 |
While testing the Mapbox Android SDK custom marker example, I ran into some errors running a simple version on a Nexus 5x. Here are the steps I took:
mimpap
instead ofdrawable
inR.drawable.ic_directions_boat_black_18dp
(and created corresponding image files in the propermipmap_
directories): same result as above..icon(icon)
: app installs and opens without error.cc: @zugaldia @bleege
The text was updated successfully, but these errors were encountered: