Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error occurred while executing doInBackground() #1549

Closed
gifary opened this issue Oct 2, 2018 · 2 comments
Closed

error occurred while executing doInBackground() #1549

gifary opened this issue Oct 2, 2018 · 2 comments

Comments

@gifary
Copy link

gifary commented Oct 2, 2018

Issue

I am getting this error when in foreground when calling function firebase.notifications().displayNotification(notification)

java.lang.RuntimeException: An error occurred while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:309)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354)
at java.util.concurrent.FutureTask.setException(FutureTask.java:223)
at java.util.concurrent.FutureTask.run(FutureTask.java:242)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)
Caused by: java.lang.NoSuchMethodError: No virtual method setColorized(Z)Landroid/support/v4/app/NotificationCompat$Builder; in class Landroid/support/v4/app/NotificationCompat$Builder; or its super classes (declaration of 'android.support.v4.app.NotificationCompat$Builder' appears in /data/app/com.hellobeauty.vendor-2/base.apk:classes2.dex)
at io.invertase.firebase.notifications.DisplayNotificationTask.doInBackground(DisplayNotificationTask.java:148)
at io.invertase.firebase.notifications.DisplayNotificationTask.doInBackground(DisplayNotificationTask.java:31)
at android.os.AsyncTask$2.call(AsyncTask.java:295)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234) 
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) 
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) 
at java.lang.Thread.run(Thread.java:818) 

Environment

  1. Application Target Platform:
    Android
  1. Development Operating System:
    Mac OS siera 10.13
  1. Build Tools:
    via terimnal using react-native run android
  1. React Native version:
    0.56
  1. React Native Firebase Version:
    ^5.0.0
  1. Firebase Module:
    Firebase messaging
  1. Are you using typescript?
    No

Loving react-native-firebase? Please consider supporting them with any of the below:

@Salakar
Copy link
Member

Salakar commented Oct 2, 2018

Duplicate issue of #1550

@Salakar Salakar closed this as completed Oct 2, 2018
@invertase invertase locked as spam and limited conversation to collaborators Oct 2, 2018
@Salakar
Copy link
Member

Salakar commented Oct 14, 2018

Hey, the issue here is that "com.android.support:support-v4" needs to be version v26 or higher as that's the version most of these API's that are causing crashes were introduced. I'd imagine it was being set to a version less than this.

You can see here that this method specifically was only introduced in version 26 of the dependency and is being called by Firebase internally but it doesn't exist in that version.

We do add checks in the code for build versions e.g. if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { (26) but if the methods don't exist in the library because the version is out of date it would have crashed.

I've just added some try catches around all the methods that we've used that were introduced in v26 of the library - so it should now gracefully continue to work on v24-25 albeit without those specific notification features functioning.

However - should this error continue to keep happening then I'd suggest ensuring you're using v26 and above of the Android support library as some of these calls may be out of our control.


Loving react-native-firebase and the support we provide? Please consider supporting us with any of the below:

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

2 participants