Native maps crash on Android

78 views
Skip to first unread message

nick.m...@gmail.com

unread,
Jul 14, 2014, 10:13:09 PM7/14/14
to codenameone...@googlegroups.com

Though native maps seem to be mostly working we are seeing some consistent crashes on Android similar to the one reported in this issue:
https://groups.google.com/forum/#!topic/codenameone-discussions/6nem4wG-_tU

Though our maps are not in a tab view.

The crash seems to happen either when entering or leaving the forms that feature maps.
The stack trace give very little information as to the root of the problem:




ERROR  
AndroidRuntime   
java.lang.IllegalArgumentException: width and height must be > 0



ERROR AndroidRuntime at android.graphics.Bitmap.createBitmap(Bitmap.java:808)



ERROR AndroidRuntime at android.graphics.Bitmap.createBitmap(Bitmap.java:787)



ERROR AndroidRuntime at android.graphics.Bitmap.createBitmap(Bitmap.java:754)



ERROR AndroidRuntime at ovh.a(Unknown Source)



ERROR AndroidRuntime at oyn.run(Unknown Source)



ERROR AndroidRuntime at java.lang.Thread.run(Thread.java:841)


and is the same in the debug build (still unknown source).


IDE: NetBeans
Desktop OS: Windows
Device: Android (Galaxy nexus and LG Nexus 4)
OS: Android 4.3 and 4.4.4

wicky...@gmail.com

unread,
Jul 15, 2014, 1:24:39 AM7/15/14
to codenameone...@googlegroups.com, nick.m...@gmail.com

I am experiencing the error again as well. From testing, it is crashing when the map is not fully loaded and some type of navigation is triggered (like navigating to the next form). Making it crash.

Important info : It happens only when the map is NOT YET FULLY LOADED.

Regards,
Wick

Shai Almog

unread,
Jul 15, 2014, 1:26:05 AM7/15/14
to codenameone...@googlegroups.com, nick.m...@gmail.com, wicky...@gmail.com
Hi,
I think I have an idea about this. Can you reproduce it with a debug build so we can get a non-obfuscated stack trace to verify?

Thanks.

wicky...@gmail.com

unread,
Jul 15, 2014, 1:52:03 AM7/15/14
to codenameone...@googlegroups.com, nick.m...@gmail.com, wicky...@gmail.com
From my email .... I have an app built on the server. Also it's android src. It is built in debug mode.

To reproduce, install it on any s2-s3 device, tab to the map, before map finishes loading tab to the news or coffee-listing page.

I am also attaching the NativeMapImplementation I customized for it to be able to show a Custom info-window with thumbnail and title on it. Its still a bit slow, meaning have to wait for the info-window to show (I think the image load is not truely async yet). But it works fine for our first version :)

Regards,
Wick
InternalNativeMapsImpl.java
InternalNativeMaps.java
MapContainer.java

wicky...@gmail.com

unread,
Jul 15, 2014, 6:37:41 AM7/15/14
to codenameone...@googlegroups.com, nick.m...@gmail.com, wicky...@gmail.com
Hi,

I have made a workaround fix for now, enabling my menus only when map completes loading. using the native googlemap.SetOnMapLoadedComplete() funciton.

I can share the src here, if anyone needs

Regards,
Wick

Shai Almog

unread,
Jul 15, 2014, 10:21:29 AM7/15/14
to codenameone...@googlegroups.com, nick.m...@gmail.com, wicky...@gmail.com
Hi,
just build a debug version and reproduce the stack trace.

nick.m...@gmail.com

unread,
Jul 15, 2014, 7:28:11 PM7/15/14
to codenameone...@googlegroups.com, nick.m...@gmail.com, wicky...@gmail.com
Hi Shai,

I ran a debug build but the stack was still obfuscated in the same way.
I thought that building it from source and running the debug directly on the device might help, but still the same error:




ERROR 
AndroidRuntime 
FATAL EXCEPTION: Thread-6061




ERROR  
AndroidRuntime  
Process: nz.co.airways.app, PID: 1476



ERROR AndroidRuntime java.lang.IllegalArgumentException: width and height must be > 0



ERROR AndroidRuntime at android.graphics.Bitmap.createBitmap(Bitmap.java:808)



ERROR AndroidRuntime at android.graphics.Bitmap.createBitmap(Bitmap.java:787)



ERROR AndroidRuntime at android.graphics.Bitmap.createBitmap(Bitmap.java:754)



ERROR AndroidRuntime at ovh.a(Unknown Source)



ERROR AndroidRuntime at oyn.run(Unknown Source)



ERROR AndroidRuntime at java.lang.Thread.run(Thread.java:841)

There dosen't seem to be any more relevent information in the trace either.

Anything else I can try?

Regards,
Nick M

Shai Almog

unread,
Jul 16, 2014, 1:29:24 AM7/16/14
to codenameone...@googlegroups.com, nick.m...@gmail.com, wicky...@gmail.com
Hi,
that's odd. I'm guessing the google maps implementation inside the device is obfuscated completely and is the root of this problem.
I'll look into working around this.

Wick S

unread,
Jul 16, 2014, 1:37:47 AM7/16/14
to Shai Almog, codenameone...@googlegroups.com, nick.m...@gmail.com
is it possible that because the lib is using a dependency (google-play-services_lib) which is obfuscated hence it is not providing the error.
And the error is coming from a Layout error, which conflicts somehow with the custom layout that codenameone is building for android as part of the translation from java to native android?

Regards,
wick

Shai Almog

unread,
Jul 16, 2014, 10:56:27 AM7/16/14
to codenameone...@googlegroups.com, shai....@gmail.com, nick.m...@gmail.com, wicky...@gmail.com
I committed an updated maps library to that might resolve this issue. Let me know either way.

Wick S

unread,
Jul 16, 2014, 12:31:33 PM7/16/14
to Shai Almog, codenameone...@googlegroups.com, nick.m...@gmail.com
Its working now,

just added the tapeventdispatcher.

thankz,
Regards,
Wick

nick.m...@gmail.com

unread,
Jul 16, 2014, 5:03:14 PM7/16/14
to codenameone...@googlegroups.com, shai....@gmail.com, nick.m...@gmail.com, wicky...@gmail.com
Hi Shai,

I pulled the update and rebuilt everything, but  I'm still getting the same issue (with the same stack trace).
It's strange because the map seems to load fine, but then after a few seconds crashes for no apparent reason.
It may or may not be related, but a container with other buttons seems to be failing to draw also (coming up black) at the same time.

Hope this helps,
Nick M

Shai Almog

unread,
Jul 17, 2014, 12:21:24 AM7/17/14
to codenameone...@googlegroups.com, shai....@gmail.com, nick.m...@gmail.com, wicky...@gmail.com
Hi,
odd. I'll have to look into this, I'm low on ideas though.
Reply all
Reply to author
Forward
0 new messages