We are getting an obscure java.lang.NullPointerException when building a Unity app for android. There's not much information here that I can trace back to our code. Does anyone have advice about how to approach debug this?

All I have to go on at the moment are logCat logs:

Uncaught exception thrown by finalizer
java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Class java.lang.Object.getClass()' on a null object reference
    at java.lang.reflect.Proxy.getInvocationHandler(Proxy.java:891)
    at bitter.jnibridge.JNIBridge.disableInterfaceProxy(Unknown Source:0)
    at bitter.jnibridge.JNIBridge.delete(Native Method)
    at bitter.jnibridge.JNIBridge$a.finalize(Unknown Source:15)
    at java.lang.Daemons$FinalizerDaemon.doFinalize(Daemons.java:250)
    at java.lang.Daemons$FinalizerDaemon.runInternal(Daemons.java:237)
    at java.lang.Daemons$Daemon.run(Daemons.java:103)
    at java.lang.Thread.run(Thread.java:764)

(Unity version : 2018.1.0b10)

  • \$\begingroup\$ One approach to find the cause of the error is to selectively disable lines of code in the C# code that initializes/references the android classes. Once you disable the line(s) that cause the issue, the error will go away. But this might not be practical if your android referring code base is too large. \$\endgroup\$ – Aj_ Mar 30 '18 at 21:15
  • \$\begingroup\$ Thanks @Aj_. Yeah it's a pretty large codebase, plus would need to be built and transferred to device to each time to test. \$\endgroup\$ – UpTheCreek Apr 6 '18 at 9:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.