j2emanue
j2emanue

Reputation: 62519

dependencies by flavor in android studio build.gradle file, is it possible?

image in my build.gradle file i have the following dependencies:

dependencies { compile 'com.android.support:support-v13:22.1.1' compile 'com.android.support:appcompat-v7:22.1.1' compile 'com.jakewharton:butterknife:6.0.0' }

and imagine i have the following product flavors defined:

productFlavors {
    germanyMock {
        applicationId "org.mymocksite.mock"
    }

    usaMock {
        applicationId "org.myqasite.qa"
    }

}

suppose i want to have a dependency by flavor only, then could i do this:

dependencies {
    compile 'com.android.support:support-v13:22.1.1'
    compile 'com.android.support:appcompat-v7:22.1.1'
    usaMockcompile 'com.jakewharton:butterknife:6.0.0'//this does not work for me
}

so the above does not work for me but i was thinking since there is a testCompile and i think a mockCompile shouldn't there be a flavorCompile ? if not how can i see all the "compiles" that are available to me ?

Upvotes: 0

Views: 218

Answers (1)

Sandro Machado
Sandro Machado

Reputation: 10205

Change to usaMockCompile change from c to C.

dependencies {
    compile 'com.android.support:support-v13:22.1.1'
    compile 'com.android.support:appcompat-v7:22.1.1'
    usaMockCompile 'com.jakewharton:butterknife:6.0.0'
}

Upvotes: 2

Related Questions