方式一:
在gradle.propertIEs中写入:
#测试环境ENV_TEST=test#开发环境ENV_DEV=dev#生产环境ENV_ONliNE=onlineAPPliCATION_ID=com.xxx.xxxxCOMPILE_SDK_VERSION=26TARGET_SDK_VERSION=26MIN_SDK_VERSION=15SUPPORT_V4_SUPPORT=com.androID.support:support-v4:26.1.0SUPPORT_ANNOTATIONS=com.androID.support:support-annotations:26.1.0SUPPORT_V7_APPCOMPAT=com.androID.support:appcompat-v7:26.1.0SUPPORT_V7_RECYCLERVIEW=com.androID.support:recyclervIEw-v7:26.1.0
使用规则,字符串直接用,整形需在后加 as int
androID { compileSdkVersion COMPILE_SDK_VERSION as int defaultConfig { applicationID APPliCATION_ID minSdkVersion MIN_SDK_VERSION as int targetSdkVersion TARGET_SDK_VERSION as int versionCode 100 versionname "1.0.0" multIDexEnabled true flavorDimensions "versionCode" testInstrumentationRunner "androID.support.test.runner.AndroIDJUnitRunner" }
方式二:
在根目录下的build.gradle文件下添加 buildscript{ .... } 中的内容:
buildscript { ext.kotlin_version = '1.1.51' ext.rxandroID = '2.0.1' ext.anko_version = '0.8.2' ext.support_version = '26.1.0' ext.target_sdk_version = 26 ext.min_sdk_version = 15 ext.applicationID = 'com.beiyijinfu.rxbusdemo' repositorIEs { Google() jcenter() } dependencIEs { classpath 'com.androID.tools.build:gradle:3.0.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "org.jetbrains.kotlin:kotlin-android-extensions:$kotlin_version" // NOTE: Do not place your application dependencIEs here; they belong // in the indivIDual module build.gradle files } }
使用规则,字符串需使用“$”,整形直接用
androID { compileSdkVersion compile_sdk_version defaultConfig { applicationID "com.xxx.xxxx" minSdkVersion min_sdk_version targetSdkVersion target_sdk_version versionCode 1 versionname "1.0" testInstrumentationRunner "androID.support.test.runner.AndroIDJUnitRunner" } } dependencIEs { implementation filetree(dir: 'libs',include: ['*.jar']) implementation"org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version" implementation "com.androID.support:appcompat-v7:$support_version" implementation "io.reactivex.rxjava2:rxandroID:$rxandroID" implementation "org.jetbrains.anko:anko-common:$anko_version" implementation "com.androID.support:recyclervIEw-v7:$support_version" }
方式三:
在根目录下的build.gradle文件下添加 ext{ .... } 中的内容:
ext{ kotlin_version = '1.1.51' rxandroID = '2.0.1' anko_version = '0.8.2' support_version = '26.1.0' target_sdk_version = 26 compile_sdk_version = 26 min_sdk_version = 15 }
使用规则,字符串需使用“$rootProject.”,整形直接用rootProject.。ext可加可不加
androID { compileSdkVersion rootProject.compile_sdk_version defaultConfig { applicationID "com.xxx.xxxx" minSdkVersion rootProject.ext.min_sdk_version targetSdkVersion rootProject.ext.target_sdk_version versionCode 1 versionname "1.0" testInstrumentationRunner "androID.support.test.runner.AndroIDJUnitRunner" } } dependencIEs { implementation filetree(dir: 'libs',include: ['*.jar']) implementation"org.jetbrains.kotlin:kotlin-stdlib-jre7:$rootProject.ext.kotlin_version" implementation "com.androID.support:appcompat-v7:$rootProject.support_version" implementation "io.reactivex.rxjava2:rxandroID:$rootProject.rxandroID" compile "org.jetbrains.anko:anko-common:$rootProject.anko_version" compile "com.androID.support:recyclervIEw-v7:$rootProject.support_version" }
方式四:
在项目根目录下创建.gradle文件,如:config.gradle,config.gradle中文件内容可以自己定义,如下示例:
ext{ kotlin_version = '1.1.51' rxandroID = '2.0.1' anko_version = '0.8.2' support_version = '26.1.0' target_sdk_version = 26 compile_sdk_version = 26 min_sdk_version = 15 }
使用规则,在build.gradle中先引用进来:
apply from :"config.gradle"dependencIEs { compile filetree(include: ['*.jar'],dir: 'libs') compile "com.androID.support
总结
以上所述是小编给大家介绍的AndroID Studio中统一管理版本号引用配置问题,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对编程小技巧网站的支持!
总结以上是内存溢出为你收集整理的Android Studio中统一管理版本号引用配置问题全部内容,希望文章能够帮你解决Android Studio中统一管理版本号引用配置问题所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)