gradle 管理 app 版本的时候不够清晰,看过其他人定义的gradle.properties, 或者新建gradle,再引入apply from: '.***.gradle'
下面是比较简单明了的方式之一
build.gradle (./app)
apply plugin: 'com.android.application'
apply plugin: 'realm-android'
ext{
COMPILE_SDK_VERSION = 25
TARGET_SDK_VERSION = 25
MIN_SDK_VERSION = 19
SUPPORT_V4 = "25.3.+"
SUPPORT_V7 = "25.3.+"
VERSION_CODE = 2
VERSION_NAME = "0.1.0"
}
android {
compileSdkVersion COMPILE_SDK_VERSION
defaultConfig {
....
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile(name: 'MPChartLib-release', ext: 'aar')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile(name: 'ljdatepicker', ext: 'aar')
compile "com.android.support:support-v4:${SUPPORT_V4}"
compile "com.android.support:appcompat-v7:${SUPPORT_V7}"
compile "com.android.support:design:${SUPPORT_V7}"
compile "com.android.support:cardview-v7:${SUPPORT_V7}"
..
}
需要注意的是 compile 的是双引号