计算不同产品风格的版本代码的代码不再适用于Android Gradle 1.0系统.我成功之前使用了下面的示例代码.
productFlavors.get(0).versionCode现在计算为null.
Gradle代码..
android {
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'
}
}
// This actual the app version code. Our given range is [0, 99999]
defaultConfig.versionCode = 123
// 2 dimensions of flavors. API is more important than ABI.
flavorGroups "api", "abi"
productFlavors {
gingerbread {
flavorGroup "api"
minSdkVersion 10
versionCode = 1
}
icecreamSandwich {
flavorGroup "api"
minSdkVersion 14
// this must be higher than the gingerbread version to ensure …Run Code Online (Sandbox Code Playgroud) 我试图根据它的a 或a 来交换res/raw文件夹和jniLibs/armeabi文件夹中的一些资源.我目前也有两种产品口味.release buildTypedebug buildType
build.gradle文件:
apply plugin: 'com.android.application'
android {
dexOptions {
preDexLibraries = false
}
compileSdkVersion 21
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.example.test"
minSdkVersion 17
targetSdkVersion 22
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
productFlavors{
phone{
applicationId "com.example.testPhone"
}
tablet{
applicationId "com.example.testTablet"
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
sourceSets{
release{
res.srcDirs = ['androidRelease/res/raw']
}
}
}
dependencies {
compile project(':facebook')
}
Run Code Online (Sandbox Code Playgroud)
是用sourceSet正确的方法吗?如果是,应该创建什么文件夹,以便它根据 …