React-native-image-crop-picker: Build Fails on Android - app:transformDexArchiveWithExternalLibsDexMergerForDebug

Created on 27 Aug 2018  路  4Comments  路  Source: ivpusic/react-native-image-crop-picker

Version

Tell us which versions you are using:

  • react-native-image-crop-picker v0.21.1
  • react-native v0.55.4

Platform

Tell us to which platform this issue is related

  • Android

Steps to reproduce

  1. Link the android version react-native link react-native-image-crop-picker

  2. Build fails

Attachments

> Task :app:transformDexArchiveWithExternalLibsDexMergerForDebug FAILED
D8: Cannot fit requested classes in a single dex file. Try supplying a main-dex list.
# methods: 69982 > 65536


FAILURE: Build failed with an exception.

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

More

Looked at the documentation but can't find proguard rules for react-native-image-crop-picker. Any pointers? Thanks

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

Most helpful comment

If it still fails a DEX error, you can try multidex

in android/build.gradle

 defaultConfig { 
        ...
        vectorDrawables.useSupportLibrary = true //image picker
        multiDexEnabled true 
}

This creates multiple DEX files if it can't fit all the dependency references in one file.
link

All 4 comments

Here's how I fixed this for me.

updated android/build.gradle

ext {
    ...
    supportLibVersion = "27.1.0"
    ...
}

added line to android\app\build.gradle

dependencies {
    ...
    implementation 'com.android.support:design:27.1.0'
    ...
}

Try this

android/build.gradle

dependencies {
    implementation ('com.android.support:design:25.3.1') {
        force = true
    }
    implementation ('com.android.support:appcompat-v7:26.1.0') {
        force = true
    }
}

If it still fails a DEX error, you can try multidex

in android/build.gradle

 defaultConfig { 
        ...
        vectorDrawables.useSupportLibrary = true //image picker
        multiDexEnabled true 
}

This creates multiple DEX files if it can't fit all the dependency references in one file.
link

Thanks all,

Tried the suggestions, didn't work :).
I'm not really android dev so it's pretty possible I'm doing something wrong.

Not really keen on testing multidex, enabling it for one package yields me doing something wrong, following online advice, unless you're sure what you're doing, it shouldn't be enabled.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

equesteo picture equesteo  路  3Comments

habovh picture habovh  路  3Comments

althurzard picture althurzard  路  3Comments

co-de picture co-de  路  3Comments

pavsidhu picture pavsidhu  路  3Comments