com.android.build.api.transform.TransformException: Error while generating the main dex list.
I am getting this error while generating apk and I could not solve it yet.
= > my android/app/build.gradle =>
implementation project(':react-native-firebase') implementation project(':react-native-gesture-handler')
//noinspection GradleDynamicVersion implementation 'com.facebook.react:react-native:+' implementation fileTree(include: ['*.jar'], dir: 'libs')
/* ---------------------------- * REACT NATIVE FIREBASE * ---------------------------- */
// Library as defined in settings.gradle implementation project(path: ':react-native-firebase', configuration: 'default')
// Required dependencies
//noinspection GradleCompatible implementation 'com.google.firebase:firebase-core:16.0.6' implementation 'com.google.android.gms:play-services-base:16.0.1'
/* -------------------------
* OPTIONAL FIREBASE SDKS
* ------------------------- */
implementation('com.google.firebase:firebase-ads:15.0.1') {
// exclude customtabs as the support lib version is out of date
// we manually add it as a dependency below with a custom version
exclude group: 'com.android.support', module: 'customtabs'
}
// Authentication implementation 'com.google.firebase:firebase-auth:16.1.0'
// Analytics implementation 'com.google.firebase:firebase-analytics:16.0.6'
// Performance Monitoring implementation 'com.google.firebase:firebase-perf:16.2.3'
// Remote Config implementation 'com.google.firebase:firebase-config:16.1.2'
// Cloud Storage implementation 'com.google.firebase:firebase-storage:16.0.5'
// Invites implementation 'com.google.firebase:firebase-invites:16.0.6'
// Dynamic Links implementation 'com.google.firebase:firebase-dynamic-links:16.1.5'
// Real-time Database implementation 'com.google.firebase:firebase-database:16.0.5'
// Cloud Functions implementation 'com.google.firebase:firebase-functions:16.1.3'
// Cloud Firestore implementation 'com.google.firebase:firebase-firestore:17.1.5'
// Cloud Messaging / FCM implementation 'com.google.firebase:firebase-messaging:17.3.4'
// Crashlytics implementation('com.crashlytics.sdk.android:crashlytics:2.9.5@aar') { transitive = true }
=> Version of the react-native-firebase => "react-native-firebase": "5.2.1",
Same issue here
I'm running into this issue as well. Upgrading my Gradle version to 4.10.1 revealed this error:
> Task :app:transformClassesWithMultidexlistForDebug FAILED
D8: Program type already present: io.invertase.firebase.database.RNFirebaseDatabase$7
Same issue, any updates?
I was facing this issue too. I removed any dependency that I installed recently, then installed it again and manually linked them, and everything was fine.
I resolved this on my side by starting over from a new clone of the react-native-firebase-starter package and then copy/pasting my source code and package dependencies on top. Perhaps this was an issue with react-native link overriding some dependency already existing in the project's build.gradle file.
Facing the same issue, can somebody please help
I'm running into this issue as well. Upgrading my Gradle version to 4.10.1 revealed this error:
> Task :app:transformClassesWithMultidexlistForDebug FAILED D8: Program type already present: io.invertase.firebase.database.RNFirebaseDatabase$7
I am getting this error also , I could not find a solution. It ussually happends when I want to generate apk file
Facing the same issue, can somebody please help
Can you try shown below ? add this flavorDimensions "versionCode" inside defaultConfig in android/app/build.gradle then add these inside android {} in android/app/build.gradle
productFlavors { // Define separate dev and prod product flavors. dev { // dev utilizes minSDKVersion = 21 to allow the Android gradle plugin // to pre-dex each module and produce an APK that can be tested on // Android Lollipop without time consuming dex merging processes. minSdkVersion 18 } prod { // The actual minSdkVersion for the application. minSdkVersion 18 } }
It may works
I got the issue fixed by running react-native unlink react-native-firebase to unlink firebase. I guess there's an issue when linking it for some reason.
I got the issue fixed by running react-native unlink react-native-firebase to unlink firebase. I guess there's an issue when linking it for some reason.
If you look at settings.gradle and MainApplication.java, there is sometime a duplicate link for some package. I think the issue comes from there.
Hello 👋, this issue has been automatically marked as stale because it has not had activity for quite some time. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. Thank you for your contributions.
Closing this issue after a prolonged period of inactivity. If this is still present in the latest release, please feel free to create a new issue with up-to-date information.
So is there a fix for this that does not involve completely rebuilding your project?
Not that I'm aware of. The good news is that copy/pasting my actual RN code over to a new project was trivial; from there all I had to do was npm install and pod install (for my iOS build).
Look at settings.gradle and MainApplication.java, and remove any package that is duplicate. My problem was coming from these files.