简体   繁体   English

android studio build.gradle文件中的flavor依赖关系,这可能吗?

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

image in my build.gradle file i have the following dependencies: 我的build.gradle文件中的图像我具有以下依赖关系:

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' } 依赖项{编译'com.android.support:support-v13:22.1.1'编译'com.android.support:appcompat-v7:22.1.1'编译'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 flavor Compile ? 所以上面的不为我工作,但我想既然有testCompile,我认为一个mockCompile不应该有一番风味编译? if not how can i see all the "compiles" that are available to me ? 如果不是,我怎么能看到所有可用的“编译”?

Change to usaMockCompile change from c to C. 更改为usaMockCompile从c更改为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'
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM