作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
好的,这是我当前的build.gradle:
apply plugin: 'com.android.application'
apply from: '../config.gradle'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId ""
minSdkVersion 15
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
resValue "int", "amountOfTables", amountOfTables
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
howManyTables.execute()
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.pnikosis:materialish-progress:1.4'
}
def amountOfTables = 15
task howManyTables << {
println amountOfTables
}
最佳答案
因为您使用def
定义了变量-所以它在脚本本身中是本地的。尝试:
config.gradle
project.ext.amountOfTables = 15
apply from: 'config.gradle' //correct path should be here
println project.amountOfTables
关于gradle - 如何从另一个gradle文件访问值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28628845/
我是一名优秀的程序员,十分优秀!