wizpanda / cordova-plugin-firebase-lib

This repository is moving & merging to https://github.com/wizpanda/cordova-plugin-firebase-lib to avoid confusion to developers.
https://www.wizpanda.com/
MIT License
68 stars 38 forks source link

Android build failure #20

Closed brad426 closed 5 years ago

brad426 commented 5 years ago

Describe the bug

After adding this plugin, my Android build fails with the following message:

Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
> com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives: 
  Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes.
  Program type already present: android.support.v4.os.ResultReceiver$MyResultReceiver

Cordova version: 9.0.0 (cordova-lib@9.0.1) cordova-android version: 8.0.0

Plugins:

If I downgrade cordova-android to 7.0.0 the app builds successfully, but I get runtime errors because window.FirebasePlugin is undefined

Any ideas about how to resolve would be greatly appreciated.

sagrawal31 commented 5 years ago

Can you try running:

cordova plugin add cordova-plugin-androidx
cordova plugin add cordova-plugin-androidx-adapter
brad426 commented 5 years ago

@sagrawal31 Yup, that fixed it. Building successfully now. Thank you very much! Struggling to test on an emulator now - Android studio build fails with error:

ERROR: The minSdk version should not be declared in the android manifest file. You can move the version from the manifest to the defaultConfig in the build.gradle file.
Move minSdkVersion to build files and sync project
Affected Modules: CordovaLib, app

But i'm sure that's something I can sort out myself

brad426 commented 5 years ago

Android studio auto refactored the project sorting out the minSdk issue, and the plugin is working perfectly now.