evollu / react-native-fcm

react native module for firebase cloud messaging and local notification
MIT License
1.73k stars 681 forks source link

error: package android.support.v4.content does not exist import android.support.v4.content.LocalBroadcastManager; #1134

Open rgaufman opened 4 years ago

rgaufman commented 4 years ago

When I try to build my app, I am getting the following:

/Users/hackeron/Development/Tether/tether-android/node_modules/react-native-fcm/android/src/main/java/com/evollu/react/fcm/MessagingService.java:8: error: package android.support.v4.content does not exist
import android.support.v4.content.LocalBroadcastManager;
                                 ^

When openning an issue, please include following information for better support

  1. react-native-fcm 16.2.4 and react-native 0.61.5
  2. Android Studio 3.6.2 on Mac Catalina
  3. I'm stuck on the build process

Any ideas?

phatlaunchdeck commented 4 years ago

@rgaufman This library does not support AndroidX yet but React Native 0.61 uses AndroidX so you have to go into the source code (the file that is throwing out the error above), delete that import line and Android Studio will suggest a new import for LocalBroadcastManager that fits AndroidX.

As I remember there're about 4 files need changing.

After done with that, you can either do the following:

  1. Edit the files every time you update your package.json.
  2. Fork the library to your account, edit the files and install the library from your repo's link so you don't have worry about #1.
Desintegrator commented 3 years ago

you can use my fork which is ready to work with AndroidX https://github.com/Desintegrator/react-native-fcm