Android standalone app stops responding every two times

I have created an app with Expo and I have built a standalone app. The problem is that the app stops responding every two times I open it. First time it works ok, second time stops responding third time ok etc. I am testing with Android 5 on physical device and Genymotion.

Any advice?

Hi-

Does this happen when you open the app in the Expo client? Or only in the standalone app?

Does this ever happen on iPhone or just Android?

What is the Expo URL of your app?
And do you have a link to the app in the App Store?

If your code is on github, that would also be helpful.

Does this happen when you open the app in the Expo client?
No, my code works in the Expo client. Only standalone app

Does this ever happen on iPhone or just Android?
I have not tried on Iphone, so only Android

What is the Expo URL of your app?
exp://exp.host/@toupilsner/bysykkel

I detached the app, and now it works every time. Seems to be a problem with the build process at your end?
I can send you the exp.json if you think that can help?

sure. that might help. thanks for letting us know. i’m not sure why it would be different when you detach. that’s very odd.

can you send the link to the apk?

Here is the APK

thanks will look at it

Looks like it’s an issue with the Branch native module we released in SDK 17. I’m pushing out an update to the standalone app builders that will fix this later today. Thanks for letting us know!

1 Like

Update is out. Let me know if it’s not working.

I will try this when I get a change, but at the moment the app is detached so I have to attach it again to test this. By the way, do you have any idea why WebBrowser.openBrowserAsync does not work in a detached Android app? If you still have the APK file you can verify that the links on the third tab does not open.

I’m still facing this issue with SDK 17…

For fix this now. Just detach and building apk manually…

it’s very hard to run adb in my environment setup ( you don’t want to know ).
i have this from google play :

java.lang.NullPointerException: 
  at versioned.host.exp.exponent.modules.api.standalone.branch.RNBranchModule$2.onReceive(RNBranchModule.java:169)
  at android.support.v4.content.u.a(LocalBroadcastManager.java:297)
  at android.support.v4.content.u.a(LocalBroadcastManager.java:46)
  at android.support.v4.content.v.handleMessage(LocalBroadcastManager.java:116)
  at android.os.Handler.dispatchMessage(Handler.java:102)
  at android.os.Looper.loop(Looper.java:154)
  at android.app.ActivityThread.main(ActivityThread.java:6692)
  at java.lang.reflect.Method.invoke(Native Method:0)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1468)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1358)

if it helps, i can provide the apk. Or if really necessary i will do adb logcat.

@gecatalin can you send me logs?

I’m having the same problem with Branch after update to SDK 19.0.0.

I was using react-native-branch package before and Branch works inside the app, but there are these crashes when I reopen the app for the 2nd time.

Managed to narrow it down to this initialization in MainActivity.java:

  protected void onStart() {
      super.onStart();
      RNBranchModule.initSession(this.getIntent().getData(), this);
  }

Doing initSession results in crash on reopening the app, removing this line results in the following error:

Attempt to invoke virtual method 'void io.branch.referral.Branch.setIdentity(javalang.String)' on a null object reference

Any suggestions on how to fix this?

The following changes to MainActivity.java seem to fix it:

import io.branch.referral.Branch;
import io.branch.referral.BranchError;

import org.json.JSONObject;

.....

@Override
  protected void onStart() {
      super.onStart();
      Branch branch = Branch.getInstance(getApplicationContext());
      branch.initSession(new Branch.BranchReferralInitListener(){
              @Override
              public void onInitFinished(JSONObject referringParams, BranchError error) {

              }
          }, this.getIntent().getData(), this);
  }