Google Play Game Services few questions

Ok. So I managed to fix the crash on debug variant on my phone by just simply selecting both architectures when bundling. But when I release the game I select both architectures too, so it shouldn’t be the cause of the crash on other devices.
Some more information : I tested my mom’s google account on my device and it works with no crashes. So it leads to conclusion that device is the problem to this, not the google account or code.

And did you run adb logcat in your console or terminal window?
What did it say then?

Do you get any information from the Google Play Console?

So I tried debugging on my mom’s phone, got a slightly different crash log;
I did some research with “system/lib/” errors, and found out that it is native error on some android versions.

Few people said that zopfli compression caused the crash on some devices:
-“This is a known issue - but unfortunately not documented anywhere. I too faced it in our app and solved by not using zopfli. For my app - happened only on OS 5.0.x.”
-“This appears to be a problem with Samsung extensions and zipalign -z (Zopfli compression). Remove the “-z” and the problem should go away.”

Does extensions use zopfli for compression?

And, how did you get that info?
That’s part of the info we need to be able to help you.

Defold libraries (and extensions) use the regular zip file format (and uses the Deflate compression algorithm). But that’s only for the download to your computer. After the cloud build is done, it’s regular native code and java.

I wrote those commands on terminal window (platform-tools folder > shift + right click > open command window here). On another device I got these messages :
adb:error: remote object … does not exist (after using adb pull /data/user/0/com.CrossMan.todo/files/_crash)
couldn’t open output file (after using adb logcat -f logcat.txt)
and $ adb shell “run-as com.CrossMan.todo sh -c ‘cat /data/data/com.CrossMan.todo/files/_crash’” > ./_crash doesn’t work too.

And, what if you just write:

$ adb logcat

what does it say?

I always got the errors on logcat, but you guys said that its not enough.
log.txt (5.1 KB)

After this command, command window just flood text (impossible to read).

That was because we couldn’t see the full log.

Also I filter the logcat log with tag:defold
Maybe if I didn’t it could give you some more details?

So, the callstack (for the main thread) is:

01-12 12:11:01.811: E/defold(30619): # 0 pc      0x17418 /system/lib/ <unknown>+0
01-12 12:11:01.811: E/defold(30619): # 1 pc      0x4a944 /system/lib/ tgkill+8
01-12 12:11:01.811: E/defold(30619): # 2 pc      0x480c3 /system/lib/ pthread_kill+34
01-12 12:11:01.811: E/defold(30619): # 3 pc      0x1dc4d /system/lib/ raise+10
01-12 12:11:01.811: E/defold(30619): # 4 pc      0x19341 /system/lib/ __libc_android_abort+34
01-12 12:11:01.811: E/defold(30619): # 5 pc      0x173a8 /system/lib/ abort+4
01-12 12:11:01.811: E/defold(30619): # 6 pc     0x3106f5 /system/lib/ _ZN3art7Runtime5AbortEPKc+328
01-12 12:11:01.811: E/defold(30619): # 7 pc      0xaa385 /system/lib/ _ZN3art10LogMessageD2Ev+1132
01-12 12:11:01.811: E/defold(30619): # 8 pc     0x22f5cd /system/lib/ _ZN3art9JavaVMExt8JniAbortEPKcS2_+1664
01-12 12:11:01.811: E/defold(30619): # 9 pc     0x22f833 /system/lib/ _ZN3art9JavaVMExt9JniAbortFEPKcS2_z+66
01-12 12:11:01.811: E/defold(30619): #10 pc     0x32a5b3 /system/lib/ _ZNK3art6Thread13DecodeJObjectEP8_jobject+302
01-12 12:11:01.811: E/defold(30619): #11 pc     0x30b5df /system/lib/ _ZN3art8ArgArray24BuildArgArrayFromVarArgsERKNS_33ScopedObjectAccessAlreadyRunnableEPNS_6mirror6ObjectESt9__va_list+174
01-12 12:11:01.811: E/defold(30619): #12 pc     0x30c5d9 /system/lib/ 

And since none of these functions come from the Defold binary, it must be related to something called previously. E.g. checking that the C++/Java logic is ok after revceiving the callback from GPGS.

1 Like

That’s what we mean with “the full log” :slight_smile:

First, you can clear the log, to make the result a lot less spammy:

$ adb logcat -c
1 Like

log.txt (594.2 KB)

There are some error lines such as :

Try filtering “COMMIT IS SUCCESSFULL” to see the log after the crash.

Btw, please avoid screenshots for such small snippets of text.
Add the text in a code block ("```") instead to make the text searchable on the forum.


And, as you see in this log file, we find a full callstack which actually comes from the Defold engine, and also a better error message:

01-12 12:53:32.182: A/art(3820): art/runtime/] JNI DETECTED ERROR IN APPLICATION: use of invalid jobject 0xa6cfc268
01-12 12:53:32.182: A/art(3820): art/runtime/] "Thread-1345" prio=10 tid=77 Runnable
01-12 12:53:32.182: A/art(3820): art/runtime/]   | sysTid=3838 nice=-10 cgrp=default sched=0/0 handle=0x89e24920
01-12 12:53:32.182: A/art(3820): art/runtime/]   | state=R schedstat=( 2884323274 752462598 4485 ) utm=186 stm=102 core=1 HZ=100
01-12 12:53:32.182: A/art(3820): art/runtime/]   native: #00 pc 003517c5  /system/lib/ (_ZN3art15DumpNativeStackERNSt3__113basic_ostreamIcNS0_11char_traitsIcEEEEiP12BacktraceMapPKcPNS_9ArtMethodEPv+128)
01-12 12:53:32.182: A/art(3820): art/runtime/]   native: #01 pc 00331ae1  /system/lib/ (_ZNK3art6Thread9DumpStackERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEEbP12BacktraceMap+308)
01-12 12:53:32.182: A/art(3820): art/runtime/]   native: #04 pc 003355b3  /system/lib/ (_ZNK3art6Thread13DecodeJObjectEP8_jobject+302)
01-12 12:53:32.182: A/art(3820): art/runtime/]   native: #05 pc 003165df  /system/lib/ (_ZN3art8ArgArray24BuildArgArrayFromVarArgsERKNS_33ScopedObjectAccessAlreadyRunnableEPNS_6mirror6ObjectESt9__va_list+174)
01-12 12:53:32.182: A/art(3820): art/runtime/]   native: #06 pc 003175d9  /system/lib/ (_ZN3art35InvokeVirtualOrInterfaceWithVarArgsERKNS_33ScopedObjectAccessAlreadyRunnableEP8_jobjectP10_jmethodIDSt9__va_list+240)
01-12 12:53:32.182: A/art(3820): art/runtime/]   native: #07 pc 0026ada1  /system/lib/ (_ZN3art3JNI15CallVoidMethodVEP7_JNIEnvP8_jobjectP10_jmethodIDSt9__va_list+444)
01-12 12:53:32.182: A/art(3820): art/runtime/]   native: #08 pc 0004dd78  /data/app/com.CrossMan.todo-1/lib/arm/ (_ZN7_JNIEnv14CallVoidMethodEP8_jobjectP10_jmethodIDz+92)
01-12 12:53:32.182: A/art(3820): art/runtime/]   native: #09 pc 0004fc04  /data/app/com.CrossMan.todo-1/lib/arm/ (_ZL30GpgDisk_SnapshotCommitAndCloseP9lua_State+576)
01-12 12:53:32.182: A/art(3820): art/runtime/]   native: #11 pc 00163a63  /data/app/com.CrossMan.todo-1/lib/arm/ (lua_pcall+40)
01-12 12:53:32.182: A/art(3820): art/runtime/]   native: #12 pc 00140cdc  /data/app/com.CrossMan.todo-1/lib/arm/ (_ZN8dmScriptL13PCallInternalEP9lua_Stateiii+84)
01-12 12:53:32.182: A/art(3820): art/runtime/]   native: #13 pc 0007b974  /data/app/com.CrossMan.todo-1/lib/arm/ (_ZN12dmGameObject19CompScriptOnMessageERKNS_24ComponentOnMessageParamsE+692)
01-12 12:53:32.182: A/art(3820): art/runtime/]   native: #14 pc 00067b8c  /data/app/com.CrossMan.todo-1/lib/arm/ (_ZN12dmGameObject24DispatchMessagesFunctionEPN9dmMessage7MessageEPv+1844)
01-12 12:53:32.182: A/art(3820): art/runtime/] 

I suspect this line:

native: #08 pc 0004dd78  /data/app/com.CrossMan.todo-1/lib/arm/ (_ZN7_JNIEnv14CallVoidMethodEP8_jobjectP10_jmethodIDz+92)

which translates to:

$ $ c++filt -n _ZN7_JNIEnv14CallVoidMethodEP8_jobjectP10_jmethodIDz
_JNIEnv::CallVoidMethod(_jobject*, _jmethodID*, ...)

which is in turn called from GpgDisk_SnapshotCommitAndClose
and it seems one of the arguments is an invalid jobject

1 Like

Are we talking about invalid metadeta object or the data I try to transfer?

I don’t know.

I didn’t use any meta data at first and was still getting crash. Yesterday I made progressValue as an metadata. The only thing that I save in the google play cloud is highscore.

This is my gpgs script. :

local use_saved_games = sys.get_config("gpgs.use_saved_games") == "1"

local function get_progress_value()
	if progressValue == nil then
		progressValue = 0
	progressValue = progressValue + Score

local function open_snapshot()
	gpgs.snapshot_open("googledata", true, gpgs.RESOLUTION_POLICY_MANUAL)

local function save_data(highscore)
	local success, error_message = gpgs.snapshot_set_data(highscore)
	if success and save == true then
		gpgs.snapshot_commit_and_close({progressValue = get_progress_value()}) --would be better to set data for the automatic conflict solver
		print("snapshot_set_data ERROR:", error_message)

local function callback(self, message_id, message)
	if message_id == gpgs.MSG_SILENT_SIGN_IN then
		if message.status == gpgs.STATUS_SUCCESS then
	elseif message_id == gpgs.MSG_SIGN_IN then
		if message.status == gpgs.STATUS_SUCCESS then
			print("can't login")
	elseif message_id == gpgs.MSG_LOAD_SNAPSHOT then
		if message.status == gpgs.STATUS_SUCCESS then
			local bytes, error_message = gpgs.snapshot_get_data()
			if not bytes then
				print("snapshot_get_data ERROR:", error_message)
				save = false
				highscore = bytes
				print("snapshot_get_data", bytes)
				-- if we have the not saved data, let's try to save it
				if self.not_saved_data then
					self.not_saved_data = nil

function init()
	if gpgs then

function update(self, dt)
	if gpgs then
		if self.is_logged_in ~= gpgs.is_logged_in() then
			self.is_logged_in = gpgs.is_logged_in()
		if use_saved_games then
			if self.snapshot_is_opened ~= gpgs.snapshot_is_opened() then
				self.snapshot_is_opened = gpgs.snapshot_is_opened()

function on_message(self, message_id, message, sender)
	if message_id == hash("set_highscore") then
		if gpgs then
			if gpgs.snapshot_is_opened() then
				print("snapshot is opened and trying to save highscore")
				print("snapshot isn't opened")
				self.not_saved_data =

function final(self)
	if gpgs then

I am having problems with Google Play Game Services too. Unsure if I should make a new thread or not, if you think it appropriate split it into a new thread.

I can not get the login to work. I have followed the extension documentation as well as followed the docs how to enabled it. I have also verified that the fingerprint of the certificate is the same.

When I try to login the screen tints for a few seconds before it resumes the app (no login screen or anything), I see no visual confirmation if it worked or not. But my print statement before logging in is in the log and the print statement in the callback indicating that it failed is also in the log.

The only indication I can see in the log of something going wrong is a bunch of java crashes with java.lang.NullPointerException: Account cannot be null.

But maybe you guys can make more sense of the log than I logcat.txt (385.2 KB)

I am building with bob and this is the command 'java -jar C:\Jerakin\bob1.2.164.jar --archive --platform armv7-android --texture-compression true --bundle-output C:\Jerakin\build --variant debug --certificate C:\Jerakin\certificate.pem --private-key C:\Jerakin\key.pk8 distclean build bundle'

I have tried on two different devices.

Wait… I think it actually works just that my logic in the callback is flawed.