Last active
June 17, 2020 09:20
-
-
Save zhEdward/9f82bfc424e2b40a60324c6101c3414e to your computer and use it in GitHub Desktop.
gradle 统一常量/依赖库 管理(一)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#各个依赖引用版本 | |
SUPPORT_V4_VERSION = 23.2.1 | |
SUPPORT_V7_VERSION = 23.2.1 | |
XUTILS_VERSION = 3.3.36 | |
UNIVERSAL_IMAGE_LOADER_VERSION = 1.9.5 | |
#编译工具的 版本 | |
COMPILE_SDK_VERSION = 23 | |
BUILD_TOOLS_VERSION = 23.0.3 | |
# TODO: use this in library/build.gradle. | |
# plugin 与gradle version 有兼容性问题 具体参考 | |
#http://tools.android.com/tech-docs/new-build-system/version-compatibility | |
// gradle-2.14.1 need plugin-2.2.0 | |
ANDROID_GRADLE_VERSION = 2.2.0 | |
TARGET_SDK_VERSION = 19 | |
MIN_SDK_VERSION = 14 | |
VERSION_CODE = 202 | |
VERSION_NAME = 1.8 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apply plugin: 'com.android.library' | |
//also apply plugin: 'com.android.application' | |
android { | |
//6.0 移除httpclient 需要额外导入library | |
//该DSL 需要gradle plugin 2.3.+以上支持 | |
useLibrary 'org.apache.http.legacy' | |
// 'as <type>' 根据 在 gradle.properties中实际的数值类型进行填写 | |
compileSdkVersion COMPILE_SDK_VERSION as int | |
buildToolsVersion BUILD_TOOLS_VERSION as String | |
defaultConfig { | |
versionName VERSION_NAME as String | |
versionCode VERSION_CODE as int | |
minSdkVersion MIN_SDK_VERSION as int | |
targetSdkVersion TARGET_SDK_VERSION as int | |
} | |
//针对代码书写不规范 严格的将导致 build 的时候 检查过不了,需要添加该排除语句 | |
lintOptions { | |
abortOnError false | |
} | |
buildTypes { | |
release { | |
minifyEnabled false | |
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' | |
} | |
} | |
} | |
dependencies { | |
//引用 全局定义 依赖库版本常量 | |
compile "com.android.support:support-v4:${SUPPORT_V4_VERSION}" | |
compile files('libs/ant-1.6.jar') | |
compile files('libs/ksoap2-android-assembly-2.4-jar-with-dependencies.jar') | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Top-level build file where you can add configuration options common to all sub-projects/modules. | |
buildscript { | |
repositories { | |
jcenter() | |
} | |
dependencies { | |
//仍旧 可以引用 'gradle.properties'中定义的 编译工具版本常量 | |
classpath "com.android.tools.build:gradle:${ANDROID_GRADLE_VERSION}" | |
} | |
} | |
allprojects { | |
repositories { | |
jcenter() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment