1

I'm using Google Play Service's map fragment in my application. On a page on its own the fragment works just fine. However, when used in another page where the fragment replaces another fragment with an ImageView in it (loaded via Picasso), the app and my phone crash with an obscure exception:

10-24 16:07:15.097 D/REQUEST ( 7454): Connection opened to:https://clients4.google.com/glm/mmap/api
10-24 16:07:15.097 D/REQUEST ( 7454): Open Connection
10-24 16:07:15.167 W/ResourceType( 7454): CREATING STRING CACHE OF 44 bytes
10-24 16:07:15.187 D/USER_EVENTS( 7454): Event: type=78, status: MD, data: T
10-24 16:07:15.197 D/dalvikvm( 7454): GC_CONCURRENT freed 2154K, 4% free 60989K/63412K, paused 4ms+2ms, total 41ms
10-24 16:07:15.197 D/dalvikvm( 7454): WAIT_FOR_CONCURRENT_GC blocked 22ms
10-24 16:07:15.197 D/dalvikvm( 7454): WAIT_FOR_CONCURRENT_GC blocked 14ms
10-24 16:07:15.197 D/dalvikvm( 7454): WAIT_FOR_CONCURRENT_GC blocked 15ms
10-24 16:07:15.197 D/dalvikvm( 7454): WAIT_FOR_CONCURRENT_GC blocked 15ms
10-24 16:07:15.197 D/dalvikvm( 7454): WAIT_FOR_CONCURRENT_GC blocked 15ms
10-24 16:07:15.207 D/dalvikvm( 7454): WAIT_FOR_CONCURRENT_GC blocked 16ms
10-24 16:07:15.207 D/dalvikvm( 7454): WAIT_FOR_CONCURRENT_GC blocked 16ms
10-24 16:07:15.207 D/dalvikvm( 7454): WAIT_FOR_CONCURRENT_GC blocked 16ms
10-24 16:07:15.227 D/USER_EVENTS( 7454): Event: type=113, status: mc, data: 
10-24 16:07:15.247 D/REQUEST ( 7454): Add Data Request: 147
10-24 16:07:15.287 D/USER_EVENTS( 7454): Event: type=58, status: gl, data: |r=8|g=8|b=8|a=0|d=24|s=8|v=Qualcomm|i=OpenGL ES-CM 1.1|c=Adreno (TM) 330|e=t|
10-24 16:07:15.407 E/mono-rt ( 7454): 
10-24 16:07:15.407 E/mono-rt ( 7454): =================================================================
10-24 16:07:15.407 E/mono-rt ( 7454): Got a SIGSEGV while executing native code. This usually indicates
10-24 16:07:15.407 E/mono-rt ( 7454): a fatal error in the mono runtime or one of the native libraries 
10-24 16:07:15.407 E/mono-rt ( 7454): used by your application.
10-24 16:07:15.407 E/mono-rt ( 7454): =================================================================
10-24 16:07:15.407 E/mono-rt ( 7454): 
10-24 16:07:15.407 F/libc    ( 7454): Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1), thread 8262 (DataRequestDisp)
10-24 16:07:15.457 W/        ( 7454): Thread 0x80484638 may have been prematurely finalized

This happens exactly at the time Google Maps is trying to load the data.

As I mentioned, the MapFragment replaces another Fragment that contains an ImageView whose content is loaded via Picasso. If I remove the ImageView the crash doesn't occur. Any ideas? Completely stumped.

James Mundy
  • 4,180
  • 6
  • 35
  • 58
  • Where's the rest of your trace? – Chris Stratton Oct 24 '14 at 16:45
  • That's all I get unfortunately. The phone crashes immediately after the last line. – James Mundy Oct 24 '14 at 16:59
  • The whole phone crashes? If that's really happening, that's not your fault, but a bug in the android build or hardware. – Chris Stratton Oct 24 '14 at 17:05
  • It might also be a beta/alpha Xamarin version, what version do you use? What device do you use? Emulator or real one? It might be an emulator problem as well. – Miha Markic Oct 24 '14 at 20:54
  • The whole phone crashes on two of my devices but both are prototypes so that's why. I've tried it on another non-prototype device and that just closes the app with the same error message. I'm using Xamarin Alpha Build 3.7.230. Used on Xperia Z2 + Z2 Ultra (prototypes) running Android 4.4.2 and a Samsung Galaxy Nexus running 4.3.2. – James Mundy Oct 25 '14 at 12:09
  • You found solution for this problem ? as I am also facing similar kind of Crash, A big headache !!! – GOLDEE Feb 26 '16 at 14:04
  • @GOLDEE please see my answer below. – James Mundy Feb 26 '16 at 14:58

2 Answers2

1

So, after lots of head scratching I found what was causing the problem.

I was using this Xamarin Picasso binding: https://github.com/jacksierkstra/Picasso Unfortunately this hadn't been updated in a while and contained a reference to an old version of Square's ok-Http library.

This version of Ok-HTTP seemed to change the global SSL context, thereby causing Google's MapFragment to break when requesting data via HTTPS. I found about the issue here: https://github.com/square/okhttp/issues/184 Thankfully, this has since been fixed so I created my own Xamarin.Picasso Binding and all is now going swimmingly.

This answer helped me start looking in the right direction: AbstractGoogleClient: Fatal signal 11 (SIGSEGV)

Community
  • 1
  • 1
James Mundy
  • 4,180
  • 6
  • 35
  • 58
1

What a headache of a bug... It took me some time to figure it out, thank you for your post! I tried your library but it fails to bind. I did find a pretty simple workaround. Add this line of code at the beginning of your application and it should do the trick!

URL.setURLStreamHandlerFactory(new OkHttpClient());
Chris
  • 3,329
  • 1
  • 30
  • 44