当我尝试为我的项目添加一种风味时,Gradle根本不想同步,即使我同步它,我也看不到Build Variats的味道。什么可能导致这个问题?该项目有几个模块,我需要为应用程序添加风味。我的档案:
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.24.4'
}
}
repositories {
maven { url 'https://maven.fabric.io/public' }
}
def keystorePropertiesFile = "${rootDir}${File.separator}keystore.properties" as File
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
android {
dexOptions {
javaMaxHeapSize "4g"
}
compileSdkVersion 25
buildToolsVersion "25.0.3"
defaultConfig {
applicationId ""
minSdkVersion 21
targetSdkVersion 25
versionCode 9999
versionName "17.2 (9999)"
}
productFlavors {
testFlavor {
applicationId "com.volodymyr.mobiletest"
}
}
def keystoreFilePath = "${System.properties['user.home']}${File.separator}${keystoreProperties['storeFile']}"
signingConfigs {
config {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile file(keystoreFilePath)
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
release {
}
debug {
}
}
splits {
abi {
enable true
reset()
include 'armeabi-v7a', 'arm64-v8a'//, 'x86', 'x86_64'
universalApk true
}
}
lintOptions {
lintConfig file("lint.xml")
check "WrongConstant"
abortOnError true
}
}
tasks.whenTaskAdded { task ->
if(task.name.equals("assembleDebug")){
task.dependsOn(lint)
}
}
dependencies {
}
我从这里删除了一些信息,比如依赖项,id等等,只是为了显示一个结构。
答案 0 :(得分:0)
错误:(15,0)ProductFlavor名称不能以'test'开头
您应该使用其他风味名称
答案 1 :(得分:0)
问题在于此gradle文件仅用于CI。要更改gradle配置,我需要在settings.gradle中改进构建文件。