ivpusic / react-native-image-crop-picker

iOS/Android image picker with support for camera, video, configurable compression, multiple images and cropping
MIT License
6.12k stars 1.56k forks source link

com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry #783

Open aspidvip opened 6 years ago

aspidvip commented 6 years ago

Version

Tell us which versions you are using:

Platform

Tell us to which platform this issue is related

Expected behaviour

Actual behaviour

Steps to reproduce

1.

2.

3.

Attachments

// stacktrace or any other useful debug info

buld

android {
    compileSdkVersion 27
    buildToolsVersion '27.0.3'

    dexOptions {
        jumboMode true
    }

    defaultConfig {
        applicationId "com.pub"
        minSdkVersion 16
        multiDexEnabled true
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        vectorDrawables.useSupportLibrary = true //this add
        ndk {
            abiFilters "armeabi-v7a", "x86"
        }
    }
    signingConfigs {
        release {
            if (project.hasProperty('MYAPP_RELEASE_STORE_FILE')) {
                storeFile file(MYAPP_RELEASE_STORE_FILE)
                storePassword MYAPP_RELEASE_STORE_PASSWORD
                keyAlias MYAPP_RELEASE_KEY_ALIAS
                keyPassword MYAPP_RELEASE_KEY_PASSWORD
            }
        }
    }
    splits {
        abi {
            reset()
            enable enableSeparateBuildPerCPUArchitecture
            universalApk true  // If true, also generate a universal APK
            include "armeabi-v7a", "x86"
        }
    }
    buildTypes {
        release {
            minifyEnabled enableProguardInReleaseBuilds
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
            signingConfig signingConfigs.release
        }
    }
    // applicationVariants are e.g. debug, release
    applicationVariants.all { variant ->
        variant.outputs.each { output ->
            // For each separate APK per architecture, set a unique version code as described here:
            // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
            def versionCodes = ["armeabi-v7a":1, "x86":2]
            def abi = output.getFilter(OutputFile.ABI)
            if (abi != null) {  // null for the universal-debug, universal-release variants
                output.versionCodeOverride =
                        versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
            }
        }
    }
}

dependencies {
    compile project(':react-native-image-crop-picker')
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.android.support:appcompat-v7:25.3.1'
    //compile 'com.android.support:appcompat-v7:23.0.1'
    compile 'com.facebook.react:react-native:+'
    // From node_modules
    compile project(':react-native-navigation')
    compile project(':react-native-vector-icons')
    compile project(':rn-fetch-blob')
    compile project(':react-native-photo-view')
    compile project(':react-native-i18n')
    compile project(':react-native-sqlite-storage')
    compile project(':react-native-linear-gradient')
    //compile project(':react-native-image-crop-picker')
    compile project(':react-native-sound')
    compile project(':react-native-open-settings')
    compile project(':react-native-push-notification')
    compile project(':react-native-device-info')
    compile project(':react-native-text-input-mask')
    compile project(':react-native-contacts')
}

// 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'
}
:app:processUniversalDebugResources
:app:processX86DebugManifest UP-TO-DATE
:app:processX86DebugResources UP-TO-DATE
:app:generateDebugSources
:app:incrementalDebugJavaCompilationSafeguard
:app:javaPreCompileDebug
:app:compileDebugJavaWithJavac
:app:mergeDebugShaders
:app:compileDebugShaders
:app:generateDebugAssets
:app:mergeDebugAssets
:app:transformClassesWithJarMergingForDebug FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: android/support/design/widget/CoordinatorLayout.class

* 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 10s
624 actionable tasks: 323 executed, 301 up-to-date

Environment: OS: macOS High Sierra 10.13.5 Node: 10.6.0 Yarn: 1.7.0 npm: 6.1.0 Watchman: 4.9.0 Xcode: Xcode 9.1 Build version 9B55 Android Studio: 3.1 AI-173.4819257

Packages: (wanted => installed) react: 16.3.1 => 16.3.1 react-native: ^0.55.3 => 0.55.4

Love react-native-image-crop-picker? Please consider supporting our collective: 👉 https://opencollective.com/react-native-image-crop-picker/donate

aspidvip commented 6 years ago

if change to file build_gradle 'react-native-image-crop-picker

apply plugin: 'com.android.library'

android {
    compileSdkVersion 27
    buildToolsVersion "27.0.3"

    defaultConfig {
        minSdkVersion 16
        targetSdkVersion 27
        versionCode 1
    }
    lintOptions {
        abortOnError false
    }
}

dependencies {
    compile 'com.facebook.react:react-native:+'
    compile 'com.github.yalantis:ucrop:2.2.2-native' => this change => compile 'com.github.yalantis:ucrop:2.2.1-native'
    compile 'id.zelory:compressor:2.1.0'
}

its work Ok!

TimurAsayonok commented 6 years ago

@aspidvip I have the same problem

gofsd commented 6 years ago

+1

cyperus commented 6 years ago

same problem

IcebergRage commented 5 years ago

@aspidvip your way fix the problem ! The thing is we need to do this after an yarn install or a npm install. How can we force this from the project, without changing the react-native-image-crop-picker's dependencies ?