crash in new app version without code change
5

I have got some crash reports after published a new app version. Code was not changed. May someone can give some advices.

java.lang.Error: FATAL EXCEPTION [main] Unity version : 2019.2.21f1 Device model : Xiaomi Redmi Note 8T Device fingerprint: xiaomi/willow_eea/willow:10/QKQ1.200114.002/V12.0.2.0.QCXEUXM:user/release-keys Caused by at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:3310) at android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:3459) at android.app.servertransaction.LaunchActivityItem.execute (LaunchActivityItem.java:83) at android.app.servertransaction.TransactionExecutor.executeCallbacks (TransactionExecutor.java:135) at android.app.servertransaction.TransactionExecutor.execute (TransactionExecutor.java:95) at android.app.ActivityThread$H.handleMessage (ActivityThread.java:2046) at android.os.Handler.dispatchMessage (Handler.java:107) at android.os.Looper.loop (Looper.java:225) at android.app.ActivityThread.main (ActivityThread.java:7564) at java.lang.reflect.Method.invoke (Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:539) at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:950) Caused by: java.lang.NullPointerException: at com.facebook.gamingservices.GameRequestDialog$FacebookAppHandler.canShow (GameRequestDialog.java:375) at com.facebook.gamingservices.GameRequestDialog$FacebookAppHandler.canShow (GameRequestDialog.java:365) at com.facebook.internal.FacebookDialogBase.createAppCallForMode (FacebookDialogBase.java:205) at com.facebook.internal.FacebookDialogBase.showImpl (FacebookDialogBase.java:148) at com.facebook.gamingservices.GameRequestDialog.showImpl (GameRequestDialog.java:260) at com.facebook.gamingservices.GameRequestDialog.showImpl (GameRequestDialog.java:64) at com.facebook.internal.FacebookDialogBase.show (FacebookDialogBase.java:143) at com.facebook.unity.FBUnityGameRequestActivity.showDialog (FBUnityGameRequestActivity.java:132) at com.facebook.unity.FBUnityGameRequestActivity.onCreate (FBUnityGameRequestActivity.java:42) at android.app.Activity.performCreate (Activity.java:7916) at android.app.Activity.performCreate (Activity.java:7903) at android.app.Instrumentation.callActivityOnCreate (Instrumentation.java:1307) at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:3285)

Lyman
Asked about 3 years ago
Lyman

I found the source code.

@Override
public boolean canShow(final GameRequestContent content, boolean isBestEffort) {
  PackageManager packageManager = getActivityContext().getPackageManager();
  Intent intent = new Intent("com.facebook.games.gaming_services.DEEPLINK");
  intent.setType("text/plain");
  boolean fbAppCanShow = intent.resolveActivity(packageManager) != null;
  AccessToken currentToken = AccessToken.getCurrentAccessToken();
  boolean isGamingLoggedIn =
      currentToken != null && currentToken.getGraphDomain().equals(FacebookSdk.GAMING);
  return fbAppCanShow && isGamingLoggedIn;
}

currentToken.getGraphDomain() is null will cause a crash. Anyone has a idea how to resolve it?

April 7 at 10:32 PM
Lyman

This crash problem appeared with Facebook SDK 9.0.0

April 8 at 12:59 AM
Selected Answer
2

I had the same issue and I checked Gradle where I had [9.0, 10) so it installed 9.1 but I had Unity wrapper for 9.0. According to change on GitHub, that piece of code you posted should be there from 9.1 https://github.com/facebook/facebook-android-sdk/compare/sdk-version-9.0.0...sdk-version-9.1.0#diff-75100f4acdb1dc0165c09243fe5684669a9054969dc133cda3ae243e49d22e22

I just locked FB libraries in gradle on 9.0.0 and it didn't crash. Hopefuly it will help to you if you have also range of versions for FB in you graddle.

But thanks for this question because it lead me to that solution.

April 21 at 1:13 AM
Zdeněk
3

Did you find any solution for that?

April 13 at 7:57 AM
Anatoliy