Error when "quitting" Unity app on Samsung Galaxy S Froyo

A clean scene rendering one quad and with a script attached to MainCamera. If I call Application.Quit() from Update() the app exits and the device vibrates 3 times (which indicates an app error):

void Update () {
	if(Input.GetKeyDown(KeyCode.Escape)) {
		Application.Quit();
	}
}

If I call Application.Quit() from a GUI.Button, the app quits perfectly:

void OnGUI() {
	if(GUI.Button(new Rect(10, 10, 150, 50), "Quit")) {
		Application.Quit();
	}
}

Any ideas?

UPDATE!
Workaround:

void Update () {
	if(Input.GetKeyDown(KeyCode.Escape)) {
		StartCoroutine(Quit());
	}
}

IEnumerator Quit() {
	yield return new WaitForSeconds(0.5f);
	Application.Quit();
}

Does this happen only in Galaxy S? Unity bug?

I’m unable to reproduce that error with the latest version of Unity, on any of my test devices. What does the logcat say at this point? Can you report this bug and attach the small project you have (in case there are some minor yet important differences) together with the logcat output from that crash?

Actually there is no need to render anything!

Project is attached.

Logcat output:

V/Unity   (26119): cpuarch.GetCpuFeatures() = 63
V/Unity   (26119): cpuarch.GetTotalMemory() = 304
V/Unity   (26119): onResume
V/Unity   (26119): onSurfaceCreated
V/Unity   (26119): onSurfaceChanged 480x800
V/Unity   (26119): initUnity
V/Unity   (26119): glGetString (GL10.GL_VERSION)='OpenGL ES 2.0'
D/Unity   (26119): Mono path[0] = '/assets/bin/Data/Managed'
D/Unity   (26119): InitializeMonoFromMain OK (4bac2f00)
D/Unity   (26119): PlayerInitEngineNoGraphics OK
D/Unity   (26119): GL_OES_rgb8_rgba8 GL_OES_depth24 GL_OES_vertex_half_float GL_OES_texture_float GL_OES_texture_half_float GL_OES_element_index_uint GL_OES_mapbuffer GL_OES_fragment_precision_high GL_OES_compressed_ETC1_RGB8_texture GL_OES_EGL_image GL_OES_required_internalformat GL_OES_depth_texture GL_OES_get_program_binary GL_OES_packed_depth_stencil GL_OES_standard_derivatives GL_OES_vertex_array_object GL_EXT_multi_draw_arrays GL_EXT_texture_format_BGRA8888 GL_EXT_discard_framebuffer GL_IMG_shader_binary GL_IMG_texture_compression_pvrtc GL_IMG_texture_stream2 GL_IMG_texture_npot GL_IMG_texture_format_BGRA8888 GL_IMG_read_format GL_IMG_program_binary
D/Unity   (26119):
D/Unity   (26119): Creating OpenGLES2.0 graphics device
D/Unity   (26119): InitializeGfxDevice OK
D/Unity   (26119): Non platform assembly: data-0x4cf46008 (this message is harmless)
D/Unity   (26119): Non platform assembly: data-0x37f810 (this message is harmless)
D/Unity   (26119): PlayerInitEngineGraphics OK
V/Unity   (26119): time to quit..
V/Unity   (26119): onPause

Unity does not output the expected “onDestroy” and the device vibrates.

476095–16718–$UnityAndroidQuit.7z (14.4 KB)

You are missing the actual error message; looks like you are filtering on "Unity"only? I need to see the ‘raw’ logcat. Also, if possible, use the bug tracker, thanks.

Hello,

I’m experiencing the same problem. It only happens when I switch off “Development build” and sign the app. With development build option enabled the app terminates correctly.

My configuration: Samsung Galaxy S 9000, Unity 3.3.04f

Also of importance maybe: I’ve included a Java library in order to integrate AdMob. The launcher Activity is derived from UnityPlayerActivity and overwrites the onCreate and onResume methods but calls super methods correctly.

Here is the logprint:

04-25 10:51:09.512: DEBUG/Unity(20372): cpuarch.GetCpuFeatures() = 63
04-25 10:51:09.512: DEBUG/Unity(20372): cpuarch.GetTotalMemory() = 304
04-25 10:51:09.754: DEBUG/Unity(20372): gles_mode = 2 (integer)
04-25 10:51:09.754: DEBUG/Unity(20372): splash_mode = 0 (integer)
04-25 10:51:13.461: DEBUG/Unity(20372): onResume
04-25 10:51:13.988: DEBUG/Unity(20372): Creating OpenGL ES 2.0 context (RGB16 565 24/8)
04-25 10:51:14.258: DEBUG/Unity(20372): onSurfaceCreated
04-25 10:51:14.375: DEBUG/Unity(20372): onSurfaceChanged 480x800
04-25 10:51:14.375: DEBUG/Unity(20372): view is 480x800
04-25 10:51:14.539: DEBUG/Unity(20372): initUnity
04-25 10:51:14.539: DEBUG/Unity(20372): glGetString (GL10.GL_VERSION)=‘OpenGL ES 2.0’
04-25 10:51:14.543: VERBOSE/Unity(20372): Mono path[0] = ‘assets/bin/Data/Managed’
04-25 10:51:15.356: VERBOSE/Unity(20372): InitializeMonoFromMain OK (4dff4f00)
04-25 10:51:15.488: VERBOSE/Unity(20372): PlayerInitEngineNoGraphics OK
04-25 10:51:15.488: VERBOSE/Unity(20372): GL_OES_rgb8_rgba8 GL_OES_depth24 GL_OES_vertex_half_float GL_OES_texture_float GL_OES_texture_half_float GL_OES_element_index_uint GL_OES_mapbuffer GL_OES_fragment_precision_high GL_OES_compressed_ETC1_RGB8_texture GL_OES_EGL_image GL_OES_required_internalformat GL_OES_depth_texture GL_OES_get_program_binary GL_OES_packed_depth_stencil GL_OES_standard_derivatives GL_OES_vertex_array_object GL_EXT_multi_draw_arrays GL_EXT_texture_format_BGRA8888 GL_EXT_discard_framebuffer GL_IMG_shader_binary GL_IMG_texture_compression_pvrtc GL_IMG_texture_stream2 GL_IMG_texture_npot GL_IMG_texture_format_BGRA8888 GL_IMG_read_format GL_IMG_program_binary
04-25 10:51:15.551: VERBOSE/Unity(20372): Creating OpenGLES2.0 graphics device
04-25 10:51:15.551: VERBOSE/Unity(20372): InitializeGfxDevice OK
04-25 10:51:15.856: VERBOSE/Unity(20372): Non platform assembly: data-0x4e43c008 (this message is harmless)
04-25 10:51:15.899: VERBOSE/Unity(20372): Non platform assembly: data-0x3833d8 (this message is harmless)
04-25 10:51:16.059: VERBOSE/Unity(20372): PlayerInitEngineGraphics OK
04-25 10:51:50.352: VERBOSE/Unity(20372): Non platform assembly: /assets/bin/Data/Managed/Boo.Lang.dll (this message is harmless)
04-25 10:51:50.410: DEBUG/Unity(20372): time to quit…
04-25 10:51:50.414: DEBUG/Unity(20372): time to quit…
04-25 10:51:50.442: DEBUG/Unity(20372): time to quit…
04-25 10:51:50.453: DEBUG/Unity(20372): onPause

As one can see “time to quit” is called several times. This might correspond with the

“Duplicate finish request for HistoryRecord{4813d710 com.mypackage/.MyProg}” in the following locat output. Whereas when built with “Development build” option set the app correctly finishes through the onStop and onDestroy methods of the Activity. Last output then is onDetachedFromWindow.

I/dalvikvm(20407): Total arena pages for JIT: 11
D/Unity (20372): time to quit…
D/Unity (20372): time to quit…
W/ActivityManager(14502): Duplicate finish request for HistoryRecord{4813d710 com.mypackage/.MyProg}
D/Unity (20372): time to quit…
W/ActivityManager(14502): Duplicate finish request for HistoryRecord{4813d710 com.mypackage/.MyProg}
D/Unity (20372): onPause
I/DEBUG (19844): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
I/DEBUG (19844): Build fingerprint: ‘samsung/GT-I9000/GT-I9000/GT-I9000:2.2/FROYO/XXJPO:user/release-keys’
I/DEBUG (19844): pid: 20372, tid: 20401 >>> com.mypackage <<<
I/DEBUG (19844): signal 11 (SIGSEGV), fault addr 000000ac
I/DEBUG (19844): r0 006176a8 r1 00000000 r2 afd43928 r3 00000000
I/DEBUG (19844): r4 4c91d720 r5 4dff4f00 r6 4dffbec0 r7 00000078
I/DEBUG (19844): r8 00100000 r9 4c873ec8 10 4e2d6000 fp 4e3d5e0c
I/DEBUG (19844): ip 4c91e2ac sp 4e3d5de8 lr 4c711994 pc 4c711764 cpsr 60000010
I/DEBUG (19844): d0 643a64696f72646e d1 6472656767756265
I/DEBUG (19844): d2 e1a0b00de24dd00e d3 eb000000e58b0030
I/DEBUG (19844): d4 e58be008ea000000 d5 e58b0000e59b0010
I/DEBUG (19844): d6 e1a0f00ce59bc008 d7 e8bd0800e28bd01c
I/DEBUG (19844): d8 0000000000000000 d9 43e0000000000000
I/DEBUG (19844): d10 41dfffffffc00000 d11 c3e0000000000000
I/DEBUG (19844): d12 0000000000000000 d13 0000000000000000
I/DEBUG (19844): d14 0000000000000000 d15 0000000000000000
I/DEBUG (19844): d16 0022f5304802adf0 d17 3f50624dd2f1a9fc
I/DEBUG (19844): d18 41b14ee3a2000000 d19 3fe000000112a880
I/DEBUG (19844): d20 4008000000000000 d21 3fd99a27ad32ddf5
I/DEBUG (19844): d22 3fd24998d6307188 d23 3fcc7288e957b53b
I/DEBUG (19844): d24 3fc74721cad6b0ed d25 3fc39a09d078c69f
I/DEBUG (19844): d26 0000000000000000 d27 0000000000000000
I/DEBUG (19844): d28 0000000000000000 d29 0000000000000000
I/DEBUG (19844): d30 0000000000000000 d31 0000000000000000
I/DEBUG (19844): scr 80000012
I/DEBUG (19844):
W/ActivityManager(14502): Activity pause timeout for HistoryRecord{4813d710 com.mypackage/.MyProg}
I/Launcher(14589): onResume(). mIsNewIntent : false
I/Launcher(14589): onResume() ended
I/Launcher(14589): onWindowFocusChanged(true)
D/Launcher.Workspace(14589): WorkspaceDraw: Workspace drawWallpaperImage()
I/DEBUG (19844): #00 pc 4c711764
I/DEBUG (19844): #01 lr 4c711994
I/DEBUG (19844):
I/DEBUG (19844): code around pc:
I/DEBUG (19844): 4c711744 e51b3014 e5933004 e1520003 3affffed
I/DEBUG (19844): 4c711754 e51b0014 e3a01001 eb04fa19 e51b301c
I/DEBUG (19844): 4c711764 e59330ac e1a00003 eb04e449 e1a03000
I/DEBUG (19844): 4c711774 e3530000 1affffd5 ebfa63c7 e51b3020
I/DEBUG (19844): 4c711784 e5933004 e1a00003 eb03eb26 e51b0020
I/DEBUG (19844):
I/DEBUG (19844): code around lr:
I/DEBUG (19844): 4c711974 e59f30f4 e0843003 e1a02003 e59f30ec
I/DEBUG (19844): 4c711984 e0843003 eb04e8bc e51b0018 ebffff45
I/DEBUG (19844): 4c711994 ea00001f e59f30e0 e0843003 e2830004
I/DEBUG (19844): 4c7119a4 ebfa6a12 e1a03000 e50b3010 e51b3010
I/DEBUG (19844): 4c7119b4 e3530000 0a000006 e3a00000 e3a01010
I/DEBUG (19844):
I/DEBUG (19844): stack:
I/DEBUG (19844): 4e3d5da8 4c91d720
I/DEBUG (19844): 4e3d5dac 4dff4f00
I/DEBUG (19844): 4e3d5db0 0048ad20 [heap]
I/DEBUG (19844): 4e3d5db4 00000010
I/DEBUG (19844): 4e3d5db8 4e3d5dcc
I/DEBUG (19844): 4e3d5dbc 4c91d720
I/DEBUG (19844): 4e3d5dc0 4dff4f00
I/DEBUG (19844): 4e3d5dc4 4dffbec0
I/DEBUG (19844): 4e3d5dc8 00000078
I/DEBUG (19844): 4e3d5dcc afd0d00d /system/lib/libc.so
I/DEBUG (19844): 4e3d5dd0 afd43928 /system/lib/libc.so
I/DEBUG (19844): 4e3d5dd4 afd0fdb4 /system/lib/libc.so
I/DEBUG (19844): 4e3d5dd8 afd43928 /system/lib/libc.so
I/DEBUG (19844): 4e3d5ddc afd0fe0c /system/lib/libc.so
I/DEBUG (19844): 4e3d5de0 e3a070ad
I/DEBUG (19844): 4e3d5de4 ef9000ad
I/DEBUG (19844): #00 4e3d5de8 4c9257a8
I/DEBUG (19844): 4e3d5dec 006176a8 [heap]
I/DEBUG (19844): 4e3d5df0 00000000
I/DEBUG (19844): 4e3d5df4 4dff4f00
I/DEBUG (19844): 4e3d5df8 4dffbec0
I/DEBUG (19844): 4e3d5dfc 00000078
I/DEBUG (19844): 4e3d5e00 00100000 [heap]
I/DEBUG (19844): 4e3d5e04 4c91d720
I/DEBUG (19844): 4e3d5e08 4e3d5e3c
I/DEBUG (19844): 4e3d5e0c 4c711994
I/DEBUG (19844): 4e3d5e10 4dff4f00
I/DEBUG (19844): 4e3d5e14 01000034 [heap]
I/DEBUG (19844): 4e3d5e18 00000000
I/DEBUG (19844): 4e3d5e1c 00000000
I/DEBUG (19844): 4e3d5e20 00000000
I/DEBUG (19844): 4e3d5e24 006176a8 [heap]
I/DEBUG (19844): 4e3d5e28 00000000
I/DEBUG (19844): 4e3d5e2c 00296850 [heap]
W/Resources(14502): Converting to boolean: TypedValue{t=0x3/d=0x5fae “res/anim/accelerate_decelerate_interpolator.xml” a=2 r=0x10a0004}
W/Resources(14502): Converting to boolean: TypedValue{t=0x3/d=0x5fae “res/anim/accelerate_decelerate_interpolator.xml” a=2 r=0x10a0004}

Is there anything I can do? The error prevents me from publishing our app.

Thanks in advance
Ben

P.S. This error occurs as well when the application is ended by clicking on a GUI button. Application.Qui() seems to be the culprit.

P.P.S. I’ve uploaded this as an error report now with a fresh project where the error is clearly reproduceable.

I too have this exact same issue.

i have the same exact issue with samsung galaxy tab

My workaround was to use this:
System.Diagnostics.Process.GetCurrentProcess().Kill();
instead of:
Application.Quit();

But I’ll try your workaround later