Skip to content
This repository has been archived by the owner on Apr 2, 2021. It is now read-only.

[Android] react-native-fbsdk 1.1.2 / 2.0.0 , RN 0.61.5 NullPointerException at com.facebook.marketing.CodelessActivityLifecycleTracker$1.onActivityPaused #750

Closed
erisvaldojunior opened this issue May 14, 2020 · 13 comments

Comments

@erisvaldojunior
Copy link

erisvaldojunior commented May 14, 2020

Having a lot of crashes with production users (RN 0.61.5, react-native-fbsdk). Integration seems to work fine and no crashes on iOS, only Android. Wasn't able to replicate it locally but Google Play Console shows tons of it.

PS: integration was made following github README instructions, no manual changes to gradle or MainApplication.java, just yarn add react-native-fbsdk , AndroidManifest.xml, strings.xml as suggested. Any ideas?

Huawei P20 Pro (HWCLT), Android 9
Report 1 of 1
java.lang.RuntimeException: 
  at android.app.ActivityThread.performPauseActivityIfNeeded (ActivityThread.java:4742)
  at android.app.ActivityThread.performPauseActivity (ActivityThread.java:4691)
  at android.app.ActivityThread.handlePauseActivity (ActivityThread.java:4626)
  at android.app.servertransaction.PauseActivityItem.execute (PauseActivityItem.java:45)
  at android.app.servertransaction.TransactionExecutor.executeLifecycleState (TransactionExecutor.java:145)
  at android.app.servertransaction.TransactionExecutor.execute (TransactionExecutor.java:70)
  at android.app.ActivityThread$H.handleMessage (ActivityThread.java:2199)
  at android.os.Handler.dispatchMessage (Handler.java:112)
  at android.os.Looper.loop (Looper.java:216)
  at android.app.ActivityThread.main (ActivityThread.java:7625)
  at java.lang.reflect.Method.invoke (Native Method)
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:524)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:987)

Caused by: java.lang.NullPointerException: 
  at com.facebook.marketing.CodelessActivityLifecycleTracker$1.onActivityPaused (CodelessActivityLifecycleTracker.java:129)
  at android.app.Application.dispatchActivityPaused (Application.java:260)
  at android.app.Activity.onPause (Activity.java:1839)
  at androidx.fragment.app.FragmentActivity.onPause (FragmentActivity.java:470)
  at com.facebook.react.ReactActivity.onPause (ReactActivity.java:57)
  at android.app.Activity.performPause (Activity.java:7663)
  at android.app.Instrumentation.callActivityOnPause (Instrumentation.java:1536)
  at android.app.ActivityThread.performPauseActivityIfNeeded (ActivityThread.java:4726)

Originally posted by @cihati in facebook/react-native#24498 (comment)

@erisvaldojunior erisvaldojunior changed the title [Android] RN 0.61.5 NullPointerException at com.facebook.marketing.CodelessActivityLifecycleTracker$1.onActivityPaused [Android] react-native-fbsdk 1.1.2 , RN 0.61.5 NullPointerException at com.facebook.marketing.CodelessActivityLifecycleTracker$1.onActivityPaused May 14, 2020
@erisvaldojunior
Copy link
Author

Seems related to #699 , probably it should be fixed on 1.1.2 but it is still happening.

@janicduplessis
Copy link
Contributor

Can you try 2.0.0, it updates facebook sdk to v7.0.

@erisvaldojunior
Copy link
Author

@janicduplessis thanks for the reply. We've upgraded to 2.0.0, I could check that iOS pods are now using FBSDKCore/Share/Login 7.0, but we are still seeing crashs for production users on Android (hundreds per day). Same stack trace, happens on several devices on Android 9.0 Pie.

The react-native-fbsdk is used only for attribution / deferred app links. We also use AppEventsLogger which seems to work fine on both platforms.

More info about the Android config:

package.json
"react": "16.9.0",
"react-native": "0.61.5",
"react-native-fbsdk": "^2.0.0",

MainApplication.java (no change, guess shouldn't add FBSDKPackage to getPackages() because of autolink)

build.gradle, settings.gradle (no change, guess shouldn't add include/project/implementation 'react-native-project-fbsdk' because of autolink

strings.xml (facebook_app_id properly set)

AndroidManifest.xml
<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/facebook_app_id"/>
<uses-permission android:name="android.permission.INTERNET" />

@erisvaldojunior erisvaldojunior changed the title [Android] react-native-fbsdk 1.1.2 , RN 0.61.5 NullPointerException at com.facebook.marketing.CodelessActivityLifecycleTracker$1.onActivityPaused [Android] react-native-fbsdk 1.1.2 / 2.0.0 , RN 0.61.5 NullPointerException at com.facebook.marketing.CodelessActivityLifecycleTracker$1.onActivityPaused May 25, 2020
@erisvaldojunior
Copy link
Author

@janicduplessis any clue?

@Hamawis
Copy link

Hamawis commented Jun 10, 2020

@erisvaldojunior were you able to resolve it?

@erisvaldojunior
Copy link
Author

@Hamawis not yet, unfortunately.

@NweThazin
Copy link

@erisvaldojunior
Hi, are you able to solve that issue?

@Hamawis
Copy link

Hamawis commented Jun 25, 2020

I fixed this by upgrading fbsdk version to 2.0.0. So no more crashes reported.

@adamfellon
Copy link

We're still seeing these issues in production on fbsdk 2.0.0, RN v0.61.5. @Hamawis can you share what version of react-native you are using as well?

Anyone else have v2.0.0 fix their issue? If so, do you mind sharing the RN version you're currently using? Think our next steps are going to be trying to update to 0.63.2

@adamfellon
Copy link

Found our issue. We had previously been on a RN version < 0.60.0, so we had manually applied the facebook dependencies in our build.gradle to point to have implementation 'com.facebook.android:facebook-android-sdk:4.34.0' ...just had to remove that and re-build & submit and that was the fix.

@janicduplessis
Copy link
Contributor

Will close as I think this is not related to this library and the crash comes from an old version of the facebook android sdk. If you are seeing this issue make sure you don't specify com.facebook.android:facebook-android-sdk:x in your build.gradle and use version 2.0+ of this library.

@imwexpex
Copy link

Will close as I think this is not related to this library and the crash comes from an old version of the facebook android sdk. If you are seeing this issue make sure you don't specify com.facebook.android:facebook-android-sdk:x in your build.gradle and use version 2.0+ of this library.

Hi! Looks like this method not works, because we still receive a lot of expections.

@imwexpex
Copy link

imwexpex commented Nov 1, 2020


com.facebook.marketing.CodelessActivityLifecycleTracker$1.onActivityPaused

java.lang.RuntimeException: 
  at android.app.ActivityThread.performPauseActivityIfNeeded (ActivityThread.java:4742)
  at android.app.ActivityThread.performPauseActivity (ActivityThread.java:4691)
  at android.app.ActivityThread.handlePauseActivity (ActivityThread.java:4626)
  at android.app.servertransaction.PauseActivityItem.execute (PauseActivityItem.java:45)
  at android.app.servertransaction.TransactionExecutor.executeLifecycleState (TransactionExecutor.java:145)
  at android.app.servertransaction.TransactionExecutor.execute (TransactionExecutor.java:70)
  at android.app.ActivityThread$H.handleMessage (ActivityThread.java:2199)
  at android.os.Handler.dispatchMessage (Handler.java:112)
  at android.os.Looper.loop (Looper.java:216)
  at android.app.ActivityThread.main (ActivityThread.java:7625)
  at java.lang.reflect.Method.invoke (Native Method)
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:524)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:987)
Caused by: java.lang.NullPointerException: 
  at com.facebook.marketing.CodelessActivityLifecycleTracker$1.onActivityPaused (CodelessActivityLifecycleTracker.java:129)
  at android.app.Application.dispatchActivityPaused (Application.java:260)
  at android.app.Activity.onPause (Activity.java:1839)
  at androidx.fragment.app.FragmentActivity.onPause (FragmentActivity.java:417)
  at com.facebook.react.ReactActivity.onPause (ReactActivity.java:50)
  at android.app.Activity.performPause (Activity.java:7663)
  at android.app.Instrumentation.callActivityOnPause (Instrumentation.java:1536)
  at android.app.ActivityThread.performPauseActivityIfNeeded (ActivityThread.java:4726)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants