Google Play Game Services few questions

#48

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

0 Likes

#49

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

0 Likes

#50

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

0 Likes

#51

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

0 Likes

#52

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

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

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

#53

Yes.
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

#54

log.txt (594.2 KB)

There are some error lines such as : http://prntscr.com/qmk63a
http://prntscr.com/qmk6ep

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

0 Likes

#55

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.

2 Likes

#56

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

I suspect this line:

native: #08 pc 0004dd78  /data/app/com.CrossMan.todo-1/lib/arm/libCrossMan.so (_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

#57

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

0 Likes

#58

I don’t know.

0 Likes

#59

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
	end
	progressValue = progressValue + Score
end

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

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

local function callback(self, message_id, message)
	if message_id == gpgs.MSG_SILENT_SIGN_IN then
		if message.status == gpgs.STATUS_SUCCESS then
			open_snapshot()
		else
			gpgs.login()
		end
	elseif message_id == gpgs.MSG_SIGN_IN then
		if message.status == gpgs.STATUS_SUCCESS then
			open_snapshot()
		else
			print("can't login")
		end
	elseif message_id == gpgs.MSG_LOAD_SNAPSHOT then
		print("MSG_LOAD_SNAPSHOT")
		if message.status == gpgs.STATUS_SUCCESS then
			print("STATUS_SUCCESS")
			local bytes, error_message = gpgs.snapshot_get_data()
			if not bytes then
				print("snapshot_get_data ERROR:", error_message)
				save = false
			else
				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
					save_data(highscore)
					self.not_saved_data = nil
				end
			end
		end
	end
end

function init()
	if gpgs then
		gpgs.set_callback(callback)
		gpgs.silent_login()
	end
end

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()
		end
		if use_saved_games then
			if self.snapshot_is_opened ~= gpgs.snapshot_is_opened() then
				self.snapshot_is_opened = gpgs.snapshot_is_opened()
			end
		end
	end
end

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")
				save_data(highscore)
			else
				print("snapshot isn't opened")
				self.not_saved_data = message.data
				open_snapshot()
			end
		end
	end
end

function final(self)
	if gpgs then
		gpgs.logout()
	end
end
0 Likes

#60

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.

0 Likes

#61

So after I removed highscore here (in gpgs.snapshot_set_data()):

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

It didn’t crash, but obviously it didn’t save data too. So the problem is with the variable highscore. Do you guys have any idea why it works perfectly on some devices, but crashes on other ones?

0 Likes

#62

No, no real clue yet, we need to debug it.
Can you create a small repro case for us to debug?

0 Likes

#63

I will try, but, as I mentioned before, it works on some devices, so there might be no crash on your device.

0 Likes

#64

If you can get a log from those devices, that would be good too.

0 Likes

#65

Here is the repro case :
(White square is the button) (The crash in this repro should happen after you click the button AND if google sign-in was successfull)

1 Like

#66

Regarding making the app debuggable on android, I suspect there’s an issue with our way of doing it (it used to work).

You can currently create a copy of AndroidManifest.xml, and add android:debuggable to it, and it should work.

0 Likes

#67

Also what could this error mean? I get this error on my repro case only. :

snapshot_set_data ERROR: nil
0 Likes