androidgradleandroid-productflavors

Adding flavour based dependencies in Android


Hi I am trying to add some dependencies based on flavour in my Android project. My code looks like as follow

android {
    
    productFlavors {
        customextended {}
        customini {}
    }
}


dependencies {
    customextendedImplimentation 'dependency_name'
}

Above code throws following error

A problem occurred evaluating project ':app'.
> Could not find method customextendedImplimentation() for arguments [dependency_name] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

Solution

  • as follows

    android {
        
        productFlavors {
            customextended {}
            customini {}
        }
    }
    
    
    dependencies {
        customextendedImplementation 'dependency_name'
    }
    

    your single misspelling