I made android game by Unity and built APK. When I got error from this game, I can see the error message:

07-06 00:35:38.905: I/Unity(31609): (Filename: ./Runtime/Export/Debug.bindings.h Line: 43)
07-06 00:35:38.906: E/Unity(31609): NullReferenceException: Object reference not set to an instance of an object
07-06 00:35:38.906: E/Unity(31609):   at GameManager.OnRealTimeMessageReceived (Boolean isReliable, System.String senderId, System.Byte[] data) [0x00000] in <filename unknown>:0 
07-06 00:35:38.906: E/Unity(31609):   at GooglePlayGames.Native.NativeRealtimeMultiplayerClient+OnGameThreadForwardingListener+<RealTimeMessageReceived>c__AnonStorey4.<>m__0 () [0x00000] in <filename unknown>:0 
07-06 00:35:38.906: E/Unity(31609):   at GooglePlayGames.OurUtils.PlayGamesHelperObject.Update () [0x00000] in <filename unknown>:0 
07-06 00:35:38.906: E/Unity(31609):  
07-06 00:35:38.906: E/Unity(31609): (Filename:  Line: -1)

However file name and error line is wrong, so I can't check where exactly error came from.

I checked my logic almost 2 hours also the object references too, but there is no logic to access undefined object code.

It could be, but I can't see where it is. I must run this app because it uses Google Play Games Service, so it requires completed built APK without developlemt option checked.

Using Application.RegisterLogCallback not much help, it has exactly same result.

How do I get exact error line in this case?


1 Answer 1


It looks like you’re using IL2CPP. If it’s possible, you might want to try targeting Mono instead, at least temporarily, which will do a better job of showing line numbers.

Also, you can still run a build in debug mode and access GPGS if you sign the APK with your release key. If you are using the internal build system, as opposed to Gradle, it should do this automatically. However, if you are using Gradle, you’ll either need to make a modification to the Gradle template, or just re-sign the apk after it’s built, using command line tools.

If all else fails, just add a bunch of Debug.Log calls (every other line, if necessary) with simple messages like “a”, “b”, “c”, etc. Look through the logcat to see the last successfully logged message before the error.

  • \$\begingroup\$ Sorry for late answer, however none of your suggestion worked. As you said at last, I inserted bunch of Debug.Log to find the problem. Thanks anyway! \$\endgroup\$
    – modernator
    Aug 12, 2018 at 11:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .