java.lang.NullPointerException when debugging with adb
See original GitHub issueHey there, this is part of the output when i use adb for debugging my app:
09-13 16:50:33.340 28812-28812/? I/Unity: AndroidJavaException: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.startsWith(java.lang.String)' on a null object reference java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.startsWith(java.lang.String)' on a null object reference at io.branch.referral.Branch.getInstance(Branch.java:464) at io.branch.unity.BranchUnityWrapper.setMaxRetries(BranchUnityWrapper.java:289) at com.unity3d.player.ReflectionHelper.nativeProxyInvoke(Native Method) at com.unity3d.player.ReflectionHelper.a(Unknown Source) at com.unity3d.player.ReflectionHelper$1.invoke(Unknown Source) at java.lang.reflect.Proxy.invoke(Proxy.java:397) at $Proxy3.run(Unknown Source) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:145) at android.app.ActivityThread.main(ActivityThread.java:5951) at java.lang.reflect.Method.invoke(Native Method) at java.lang.re 09-13 16:50:33.360 28812-28812/? I/Unity: AndroidJavaException: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.startsWith(java.lang.String)' on a null object reference java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.startsWith(java.lang.String)' on a null object reference at io.branch.referral.Branch.getInstance(Branch.java:464) at io.branch.unity.BranchUnityWrapper.setNetworkTimeout(BranchUnityWrapper.java:293) at com.unity3d.player.ReflectionHelper.nativeProxyInvoke(Native Method) at com.unity3d.player.ReflectionHelper.a(Unknown Source) at com.unity3d.player.ReflectionHelper$1.invoke(Unknown Source) at java.lang.reflect.Proxy.invoke(Proxy.java:397) at $Proxy3.run(Unknown Source) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:145) at android.app.ActivityThread.main(ActivityThread.java:5951) at java.lang.reflect.Method.invoke(Native Method) at java.lan 09-13 16:50:33.380 28812-28812/? I/Unity: AndroidJavaException: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.startsWith(java.lang.String)' on a null object reference java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.startsWith(java.lang.String)' on a null object reference at io.branch.referral.Branch.getInstance(Branch.java:464) at io.branch.unity.BranchUnityWrapper.setRetryInterval(BranchUnityWrapper.java:285) at com.unity3d.player.ReflectionHelper.nativeProxyInvoke(Native Method) at com.unity3d.player.ReflectionHelper.a(Unknown Source) at com.unity3d.player.ReflectionHelper$1.invoke(Unknown Source) at java.lang.reflect.Proxy.invoke(Proxy.java:397) at $Proxy3.run(Unknown Source) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:145) at android.app.ActivityThread.main(ActivityThread.java:5951) at java.lang.reflect.Method.invoke(Native Method) at java.lang
This doesnt break the app and branch still seems to work, but maybe this should be fixed. I dont know what it does and what is missing, maybe you know it.
Issue Analytics
- State:
- Created 7 years ago
- Comments:15 (6 by maintainers)
@antonargunov nvm! I called these 3 methods in Awake:
Branch.setMaxRetries(5); Branch.setNetworkTimeout(10); Branch.setRetryInterval(3);
But moving them over to Start() resolved the problem.
Glad to have found this… I updated the Start() with Awake() for Branch to get in early, but didn’t realise this would cause an exception. Might be worth adding a comment above the Start() to warn developers to not update to Awake() 😉