androidkotlingradledex

How to fix "'dexOptions(Action<DexOptions>): Unit' is deprecated. Setting dexOptions is obsolete."?


Recently, I've updated my gradle version from 4.0.0 to 7.0.3. After this update, getting dexOptions is obsolete warning. Still, I'm able to compile the project but don't know how to fix this warning. This what my current implementation,

dexOptions {
    preDexLibraries = true
}

Here is the warning I'm getting. Help me to solve this. enter image description here


Solution

  • You just need to delete that block,

    The full error from the build console is:

    WARNING:DSL element 'dexOptions' is obsolete and should be removed.
    It will be removed in version 8.0 of the Android Gradle plugin.
    Using it has no effect, and the AndroidGradle plugin optimizes dexing automatically.
    

    So this should be safe to remove entirely