-
Notifications
You must be signed in to change notification settings - Fork 159
Open
Labels
Description
Describe the bug
If I try to use validateSDKIntegration on Android, I get this error:
java.lang.NullPointerException: Attempt to invoke virtual method 'void io.branch.referral.validators.IntegrationValidatorDialog.SetTestResultForRowItem(int, java.lang.String, boolean, java.lang.String, java.lang.String)' on a null object reference
at io.branch.referral.validators.IntegrationValidator.doValidateWithAppConfig(IntegrationValidator.java:68)
at io.branch.referral.validators.IntegrationValidator.onAppConfigAvailable(IntegrationValidator.java:127)
at io.branch.referral.validators.ServerRequestGetAppConfig.onRequestSucceeded(ServerRequestGetAppConfig.java:28)
at io.branch.referral.ServerRequestQueue$BranchPostTask.onRequestSuccess(ServerRequestQueue.java:658)
at io.branch.referral.ServerRequestQueue$BranchPostTask.onPostExecuteInner(ServerRequestQueue.java:574)
at io.branch.referral.ServerRequestQueue$BranchPostTask.onPostExecute(ServerRequestQueue.java:559)
at io.branch.referral.ServerRequestQueue$BranchPostTask.onPostExecute(ServerRequestQueue.java:512)
at android.os.AsyncTask.finish(AsyncTask.java:771)
at android.os.AsyncTask.-$$Nest$mfinish(Unknown Source:0)
at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:788)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:7872)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
Steps to reproduce
- Install React Native package using the instruction
- Call
branch.validateSDKIntegration()inside an useEffect with zero dependencies onApp.tsx
Expected behavior
The dialog with validation results should appear
SDK Version
5.18.1
Make and Model
Pixel 7 (Emulator)
OS
13
Additional Information/Context
Looking at the code on Branch-SDK/src/main/java/io/branch/referral/validators/IntegrationValidator.java
Branch.enableLogging(iBranchLoggingCallbacks);
instance.validateSDKIntegration(context);
instance.integrationValidatorDialog = new IntegrationValidatorDialog(context);seems that instantiation of integrationValidatorDialog happens after validateSDKIntegration.
Rewriting this part in this way:
instance.integrationValidatorDialog = new IntegrationValidatorDialog(context);
Branch.enableLogging(iBranchLoggingCallbacks);
instance.validateSDKIntegration(context);could fix my problem?
howwellapp