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

Incompatibility with firebase_messaging - Android #95

Closed
ederbaum opened this issue Jun 17, 2019 · 4 comments
Closed

Incompatibility with firebase_messaging - Android #95

ederbaum opened this issue Jun 17, 2019 · 4 comments

Comments

@ederbaum
Copy link

The firebase_messaging is causing a lot of problemas when using plugins like file_picker. The error is very simple to reproduce:

That's my pubspec.yaml:

environment:
  sdk: ">=2.1.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter

  file_picker: ^1.3.5
  firebase_messaging: ^5.0.3 # Remove this and no error

Just use the command "flutter build apk" to see the error bellow:
Just remove the firebase_messaging plugin (or file_picker) and the error disappear.

D8: Program type already present: android.support.v4.app.INotificationSideChannel
                                                                        
FAILURE: Build failed with an exception.                                
                                                                        
* What went wrong:                                                      
Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForRelease'.
> com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives: A LONG LIST OF FILES
  Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes.
  Program type already present: android.support.v4.app.INotificationSideChannel
                                                                        
* Try:                                                                  
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
                                                                        
* Get more help at https://help.gradle.org                              
                                                                        
BUILD FAILED in 8s                                                      
Running Gradle task 'assembleRelease'...                                
Running Gradle task 'assembleRelease'... Done                       8,5s
*******************************************************************************************
The Gradle failure may have been because of AndroidX incompatibilities in this Flutter app.
See https://goo.gl/CP92wY for more information on the problem and how to fix it.
*******************************************************************************************
Gradle task assembleRelease failed with exit code 1

The error is very similar in this plugin: crazecoder/open_file#43

@miguelpruivo
Copy link
Owner

Hi @ederbaum, what let you think that this is this plugin’s fault?

If this is happening with multiple plugins and Firebase, probably is related with some incompatibility with the Firebase plugin itself. The one you posted as a reference has a dependency resolution fix, does that work for you?

Have you tried another Firebase version anyway?

I would like to help you, but this are one of the cases where I can’t do much about it, since the file_picker is quite flexible (supporting all versions from api 16) and also is not dependent of something else. I always try to have packages as dependency free as possible.

@altherat
Copy link

altherat commented Jun 18, 2019

I'm also getting a similar error using this library with flutter_zxing. Not sure which library is at fault but considering that there's this issue and #93, I'd have to guess this library is the culprit if it's having so many problems with others.

Edit: Never mind, resolved by migrating to Android X as per https://flutter.dev/docs/development/packages-and-plugins/androidx-compatibility

@miguelpruivo
Copy link
Owner

@ederbaum you need to have Android X compatibility as @altherat pointed out. This may lead to some confusion when packages are mixed out, since some have already migrated and others don't (although at this point, they all should).

Just let me know if it solved for you as well.

@ederbaum
Copy link
Author

Exactly.
I followed these steps and it worked: https://medium.com/@swhussain110/how-to-migrate-your-flutter-app-to-androidx-9a78eaaa924b

And after: "flutter clean"

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

No branches or pull requests

3 participants