cesardeazevedo / react-native-collapsing-toolbar

react-native wrapper for android CollapsingToolbarLayout
MIT License
293 stars 33 forks source link

D8: Program type already present: android.support.design.widget.CoordinatorLayout$Behavior #20

Open zakayothuku opened 6 years ago

zakayothuku commented 6 years ago

keep getting a build error when i try to build the app:

Task :app:transformDexArchiveWithExternalLibsDexMergerForDebug FAILED

The Stacktrace is as follows:

` What went wrong: Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.

com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:

D:\Projects\REACT-NATIVE\App\android\app\build\intermediates\transforms\dexBuilder\debug\0.jar, D:\Projects\REACT-NATIVE\App\android\app\build\intermediates\transforms\dexBuilder\debug\7.jar, D:\Projects\REACT-NATIVE\App\android\app\build\intermediates\transforms\dexBuilder\debug\8.jar, D:\Projects\REACT-NATIVE\App\android\app\build\intermediates\transforms\dexBuilder\debug\12.jar, D:\Projects\REACT-NATIVE\App\android\app\build\intermediates\transforms\dexBuilder\debug\13.jar, D:\Projects\REACT-NATIVE\App\android\app\build\intermediates\transforms\dexBuilder\debug\14.jar, D:\Projects\REACT-NATIVE\App\android\app\build\intermediates\transforms\dexBuilder\debug\15.jar, D:\Projects\REACT-NATIVE\App\android\app\build\intermediates\transforms\dexBuilder\debug\16.jar, D:\Projects\REACT-NATIVE\App\android\app\build\intermediates\transforms\dexBuilder\debug\17.jar, D:\Projects\REACT-NATIVE\App\android\app\build\intermediates\transforms\dexBuilder\debug\23.jar, D:\Projects\REACT-NATIVE\App\android\app\build\intermediates\transforms\dexBuilder\debug\24.jar, D:\Projects\REACT-NATIVE\App\android\app\build\intermediates\transforms\dexBuilder\debug\25.jar, D:\Projects\REACT-NATIVE\App\android\app\build\intermediates\transforms\dexBuilder\debug\26.jar, D:\Projects\REACT-NATIVE\App\android\app\build\intermediates\transforms\dexBuilder\debug\27.jar, D:\Projects\REACT-NATIVE\App\android\app\build\intermediates\transforms\dexBuilder\debug\28.jar, D:\Projects\REACT-NATIVE\App\android\app\build\intermediates\transforms\dexBuilder\debug\29.jar, D:\Projects\REACT-NATIVE\App\android\app\build\intermediates\transforms\dexBuilder\debug\30.jar, D:\Projects\REACT-NATIVE\App\android\app\build\intermediates\transforms\dexBuilder\debug\31.jar, D:\Projects\REACT-NATIVE\App\android\app\build\intermediates\transforms\dexBuilder\debug\32.jar, D:\Projects\REACT-NATIVE\App\android\app\build\intermediates\transforms\dexBuilder\debug\34.jar, D:\Projects\REACT-NATIVE\App\android\app\build\intermediates\transforms\dexBuilder\debug\35.jar, D:\Projects\REACT-NATIVE\App\android\app\build\intermediates\transforms\dexBuilder\debug\41.jar, D:\Projects\REACT-NATIVE\App\android\app\build\intermediates\transforms\dexBuilder\debug\45.jar, D:\Projects\REACT-NATIVE\App\android\app\build\intermediates\transforms\dexBuilder\debug\49.jar, D:\Projects\REACT-NATIVE\App\android\app\build\intermediates\transforms\dexBuilder\debug\51.jar, D:\Projects\REACT-NATIVE\App\android\app\build\intermediates\transforms\dexBuilder\debug\52.jar, D:\Projects\REACT-NATIVE\App\android\app\build\intermediates\transforms\dexBuilder\debug\53.jar, D:\Projects\REACT-NATIVE\App\android\app\build\intermediates\transforms\dexBuilder\debug\55.jar, D:\Projects\REACT-NATIVE\App\android\app\build\intermediates\transforms\dexBuilder\debug\57.jar, D:\Projects\REACT-NATIVE\App\android\app\build\intermediates\transforms\dexBuilder\debug\128.jar, D:\Projects\REACT-NATIVE\App\android\app\build\intermediates\transforms\dexBuilder\debug\129.jar, D:\Projects\REACT-NATIVE\App\android\app\build\intermediates\transforms\dexBuilder\debug\130.jar, D:\Projects\REACT-NATIVE\App\android\app\build\intermediates\transforms\dexBuilder\debug\137.jar, D:\Projects\REACT-NATIVE\App\android\app\build\intermediates\transforms\dexBuilder\debug\138.jar, D:\Projects\REACT-NATIVE\App\android\app\build\intermediates\transforms\dexBuilder\debug\139.jar, D:\Projects\REACT-NATIVE\App\android\app\build\intermediates\transforms\dexBuilder\debug\140.jar, D:\Projects\REACT-NATIVE\App\android\app\build\intermediates\transforms\dexBuilder\debug\141.jar, D:\Projects\REACT-NATIVE\App\android\app\build\intermediates\transforms\dexBuilder\debug\145.jar, D:\Projects\REACT-NATIVE\App\android\app\build\intermediates\transforms\dexBuilder\debug\146.jar, D:\Projects\REACT-NATIVE\App\android\app\build\intermediates\transforms\dexBuilder\debug\147.jar, D:\Projects\REACT-NATIVE\App\android\app\build\intermediates\transforms\dexBuilder\debug\148.jar, D:\Projects\REACT-NATIVE\App\android\app\build\intermediates\transforms\dexBuilder\debug\156.jar, D:\Projects\REACT-NATIVE\App\android\app\build\intermediates\transforms\dexBuilder\debug\157.jar, D:\Projects\REACT-NATIVE\App\android\app\build\intermediates\transforms\dexBuilder\debug\ 164.jar, D:\Projects\REACT-NATIVE\App\android\app\build\intermediates\transforms\dexBuilder\debug\175.jar, D:\Projects\REACT-NATIVE\App\android\app\build\intermediates\transforms\dexBuilder\debug\176.jar, D:\Projects\REACT-NATIVE\App\android\app\build\intermediates\transforms\dexBuilder\debug\177.jar, D:\Projects\REACT-NATIVE\App\android\app\build\intermediates\transforms\dexBuilder\debug\178.jar, D:\Projects\REACT-NATIVE\App\android\app\build\intermediates\transforms\dexBuilder\debug\182.jar, D:\Projects\REACT-NATIVE\App\android\app\build\intermediates\transforms\dexBuilder\debug\184.jar, D:\Projects\REACT-NATIVE\App\android\app\build\intermediates\transforms\dexBuilder\debug\185.jar, D:\Projects\REACT-NATIVE\App\android\app\build\intermediates\transforms\dexBuilder\debug\186.jar, D:\Projects\REACT-NATIVE\App\android\app\build\intermediates\transforms\dexBuilder\debug\187.jar, D:\Projects\REACT-NATIVE\App\android\app\build\intermediates\transforms\dexBuilder\debug\188.jar, D:\Projects\REACT-NATIVE\App\android\app\build\intermediates\transforms\dexBuilder\debug\189.jar, D:\Projects\REACT-NATIVE\App\android\app\build\intermediates\transforms\dexBuilder\debug\190.jar, D:\Projects\REACT-NATIVE\App\android\app\build\intermediates\transforms\dexBuilder\debug\191.jar, D:\Projects\REACT-NATIVE\App\android\app\build\intermediates\transforms\dexBuilder\debug\192.jar, D:\Projects\REACT-NATIVE\App\android\app\build\intermediates\transforms\dexBuilder\debug\193.jar, D:\Projects\REACT-NATIVE\App\android\app\build\intermediates\transforms\dexBuilder\debug\194.jar, D:\Projects\REACT-NATIVE\App\android\app\build\intermediates\transforms\dexBuilder\debug\195.jar, D:\Projects\REACT-NATIVE\App\android\app\build\intermediates\transforms\dexBuilder\debug\196.jar, D:\Projects\REACT-NATIVE\App\android\app\build\intermediates\transforms\dexBuilder\debug\197.jar, D:\Projects\REACT-NATIVE\App\android\app\build\intermediates\transforms\dexBuilder\debug\198.jar, D:\Projects\REACT-NATIVE\App\android\app\build\intermediates\transforms\dexBuilder\debug\199.jar, D:\Projects\REACT-NATIVE\App\android\app\build\intermediates\transforms\dexBuilder\debug\200.jar, D:\Projects\REACT-NATIVE\App\android\app\build\intermediates\transforms\dexBuilder\debug\201.jar, D:\Projects\REACT-NATIVE\App\android\app\build\intermediates\transforms\dexBuilder\debug\202.jar, D:\Projects\REACT-NATIVE\App\android\app\build\intermediates\transforms\dexBuilder\debug\203.jar, D:\Projects\REACTNATIVE\App\android\app\build\intermediates\transforms\dexBuilder\debug\204.jar, D:\Projects\REACT-NATIVE\App\android\app\build\intermediates\transforms\dexBuilder\debug\205.jar, D:\Projects\REACT-NATIVE\App\android\app\build\intermediates\transforms\dexBuilder\debug\206.jar, D:\Projects\REACT-NATIVE\App\android\app\build\intermediates\transforms\dexBuilder\debug\207.jar, D:\Projects\REACT-NATIVE\App\android\app\build\intermediates\transforms\dexBuilder\debug\208.jar, D:\Projects\REACT-NATIVE\App\android\app\build\intermediates\transforms\dexBuilder\debug\209.jar, D:\Projects\REACT-NATIVE\App\android\app\build\intermediates\transforms\dexBuilder\debug\214.jar, D:\Projects\REACT-NATIVE\App\android\app\build\intermediates\transforms\dexBuilder\debug\215.jar, D:\Projects\REACT-NATIVE\App\android\app\build\intermediates\transforms\dexBuilder\debug\216.jar, D:\Projects\REACT-NATIVE\App\android\app\build\intermediates\transforms\dexBuilder\debug\218.jar, D:\Projects\REACT-NATIVE\App\android\app\build\intermediates\transforms\dexBuilder\debug\219.jar, D:\Projects\REACT-NATIVE\App\android\app\build\intermediates\transforms\dexBuilder\debug\220.jar, D:\Projects\REACT-NATIVE\App\android\app\build\intermediates\transforms\dexBuilder\debug\222.jar, D:\Projects\REACT-NATIVE\App\android\app\build\intermediates\transforms\dexBuilder\debug\223.jar, D:\Projects\REACT-NATIVE\App\android\app\build\intermediates\transforms\dexBuilder\debug\224.jar

BUILD FAILED in 1m 15s 229 actionable tasks: 1 executed, 228 up-to-date Could not install the app on the device, read the error above for details. Make sure you have an Android emulator running or a device connected and have set up your Android development environment: https://facebook.github.io/react-native/docs/getting-started.html Done in 155.51s.

`

What could be the issue?

cesardeazevedo commented 6 years ago

Hi, can you post your build.gradle and the app/build.gradle files and what react and react-native version are you using?

zakayothuku commented 6 years ago

build.gradle

`// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript { repositories { jcenter() google() } dependencies { classpath 'com.android.tools.build:gradle:3.1.3'

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
    classpath 'com.google.gms:google-services:4.0.1'
}

}

allprojects { repositories { mavenLocal() google() jcenter() maven { url 'https://maven.google.com' } maven { // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm url "$rootDir/../node_modules/react-native/android" } } }`

app/build.gradle

`dependencies { implementation project(':react-native-linear-gradient') implementation project(':react-native-native-video-player') implementation project(':react-native-push-notification') implementation project(':react-native-photo-view') implementation project(':react-native-blur') implementation project(':react-native-fetch-blob') implementation project(':react-native-filesystem-v1') implementation project(':react-native-svg') implementation project(':react-native-vector-icons') implementation project(':react-native-nested-scroll-view') implementation project(':react-native-collapsing-toolbar'){ exclude group: 'com.android.support', module: 'appcompat-v7' } implementation(project(':react-native-maps')){ exclude group: 'com.google.android.gms', module: 'play-services-base' exclude group: 'com.google.android.gms', module: 'play-services-maps' } implementation(project(':react-native-fbsdk')){ // See https://stackoverflow.com/questions/44190829/facebook-sdk-android-error-building/44190896#44190896 exclude(group: 'com.facebook.android', module: 'facebook-android-sdk') } implementation ("com.google.android.gms:play-services-base:15.0.1") { force = true; } implementation ("com.google.android.gms:play-services-maps:15.0.1") { force = true; }

implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.facebook.android:facebook-android-sdk:+"

//noinspection GradleCompatible
implementation "com.android.support:appcompat-v7:27.1.1"
implementation "com.facebook.react:react-native:+"  // From node_modules

}

// Run this once to be able to run the application with BUCK // puts all compile dependencies into folder libs for BUCK to use task copyDownloadableDepsToLibs(type: Copy) { from configurations.compile into 'libs' }`

cesardeazevedo commented 6 years ago

I just did some tests, i was be able to reproduce by removing the support design dependency, which you need to include

implementation 'com.android.support:design:27.1.1'

Let me know if you got it

aligholizade commented 5 years ago

same problem

Akash-T2S commented 5 years ago

Same issue, Is there any other way to solve it ?