Usage with @capacitor-community/fcm causes crash on android
timmyrosen opened this issue · 1 comments
Describe the bug
Hi! Im using this plugin together with @capacitor-community/fcm (both on latest version) and when I run my app on my android device it crashes on startup.
To Reproduce
Steps to reproduce the behavior:
- Install both @capacitor-community/fcm and @capacitor-community/firebase-analytics.
- Run
npx cap sync
In my MainActivity.java file, I have added
import com.getcapacitor.community.fcm.FCMPlugin;
import com.getcapacitor.community.firebaseanalytics.FirebaseAnalytics;
public class MainActivity extends BridgeActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Initializes the Bridge
this.init(savedInstanceState, new ArrayList<Class<? extends Plugin>>() {{
// Additional plugins you've installed go here
add(FirebaseAnalytics.class);
add(FCMPlugin.class);
}});
}
}
When I run the app through android studio, it builds successfully but crashes instantly after splashscreen.
Smartphone (please complete the following information):
- Device: OnePlus 8 Pro
- OS: MacOS 10.14.6
- Android Studio: 3.6.2
- @capacitor/android: 2.4.0,
- @capacitor/core: 2.4.0,
- @capacitor-community/fcm: 1.0.8,
- @capacitor-community/firebase-analytics: 0.2.0,
Additional context
I have tried reversing the order of the added plugins but to no luck.
On iOS everything works perfectly.
If I comment out the FCMPlugin.class line the app starts.
If I remove the analytics line + import, the app still crashes. I have to remove the plugin completely for the app to work again.
So I can start the app using either of these plugins seperately but not together.
Ok I solved it thanks to this comment
ionic-team/capacitor#2906 (comment)