dhe*_*raj 2 android gradle google-play-services build.gradle android-gradle-plugin
我的项目有免费和付费版本,
免费版使用Admob服务,但付费版没有任何广告.如何删除付费版本的依赖项
这是我的build.gradle文件
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.udacity.gradle.builditbigger"
minSdkVersion 10
targetSdkVersion 22
versionCode 1
versionName "1.0"
testApplicationId"com.udacity.gradle.builditbigger.tests"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors{
free{
applicationId"com.udacity.gradle.builditbigger.flavours.free"
}
paid{
applicationId"com.udacity.gradle.builditbigger.flavours.paid"
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
// Added for AdMob
compile project(':mylibrary')
compile project(path: ':endpoint-backend', configuration: 'android-endpoints')
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.google.android.gms:play-services:7.5.0'
}
Run Code Online (Sandbox Code Playgroud)
我希望依赖项编译'com.google.android.gms:play-services:7.5.0'仅适用于免费版本,但不适用于付费版本.
要为不同的构建类型或风格添加不同的依赖项,可以使用它
dependencies {
releaseCompile
debugCompile
flavor1Compile
flavor1DebugCompile
}
Run Code Online (Sandbox Code Playgroud)
在你的情况下:
dependencies {
freeCompile 'com.google.android.gms:play-services:7.5.0'
}
Run Code Online (Sandbox Code Playgroud)
此外,如果您需要olny Admob,您应该使用此依赖项而不是完整的播放服务.
compile 'com.google.android.gms:play-services-ads:7.8.0'
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
762 次 |
| 最近记录: |