react-native-firebase icon indicating copy to clipboard operation
react-native-firebase copied to clipboard

com.android.build.api.transform.TransformException: Error while generating the main dex list.

Open denizbas92 opened this issue 7 years ago • 15 comments

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",

denizbas92 avatar Mar 04 '19 15:03 denizbas92

Same issue here

matthieu994 avatar Mar 05 '19 22:03 matthieu994

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

panoptical2 avatar Mar 08 '19 04:03 panoptical2

Same issue, any updates?

frostbyte3 avatar Mar 10 '19 19:03 frostbyte3

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.

matthieu994 avatar Mar 10 '19 19:03 matthieu994

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.

panoptical2 avatar Mar 11 '19 21:03 panoptical2

Facing the same issue, can somebody please help

rohit75 avatar Mar 18 '19 12:03 rohit75

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

denizbas92 avatar Mar 18 '19 12:03 denizbas92

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

denizbas92 avatar Mar 18 '19 12:03 denizbas92

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.

frostbyte3 avatar Mar 19 '19 02:03 frostbyte3

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.

matthieu994 avatar Mar 19 '19 14:03 matthieu994

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.

stale[bot] avatar Apr 16 '19 14:04 stale[bot]

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.

stale[bot] avatar May 06 '19 14:05 stale[bot]

So is there a fix for this that does not involve completely rebuilding your project?

hindsricardo avatar May 23 '19 15:05 hindsricardo

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).

panoptical2 avatar May 23 '19 15:05 panoptical2

Look at settings.gradle and MainApplication.java, and remove any package that is duplicate. My problem was coming from these files.

matthieu994 avatar May 23 '19 16:05 matthieu994