解析adle文件

更新时间:2023-06-30 19:25:50 阅读: 评论:0

解析adle⽂件
Gradle是⼀个⾮常先进的项⽬构建⼯具,它使⽤了⼀种基于Groovy的领域特定语⾔DSL来声明项⽬设置,摒弃了传统XML(如Ant和Maven)的各种繁琐配置
项⽬结构如上图:
1、最外层⽬录下的adle⽂件(通常情况下不需要修改这个⽂件内容),代码如下所⽰:
buildscript {
repositories {
郁郁寡欢是什么意思google()
jcenter()
}
dependencies {
classpath 'ls.build:gradle:3.1.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual adle files
demon什么意思
heaton}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
archie
(1)这些代码都是⾃动⽣成的,两处repositories的闭包中都声明了jcenter()这⾏配置,jcenter是⼀个代码托管仓库,配置之后我们能够轻松引⽤任何jcenter上的开源项⽬。
(2)dependencies闭包中使⽤classpath声明了⼀个Gradle插件。最后⾯部分为插件版本号
2、app⽬录下的adle⽂件,代码如下:
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
  buildeToolsVersion “24.0.2”
defaultConfig {
applicationId "st01"
minSdkVersion 15
人教版高一英语必修一targetSdkVersion 28
贮藏versionCode 1
versionName "1.0"
itisme
testInstrumentationRunner "st.runner.AndroidJUnitRunner"
}
buildTypes {
relea {
minifyEnabled fal
proguardFiles getDefaultProguardFile(''), 'proguard-rules.pro'
}
}
}
美国2016大选dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:28.0.0-alpha3'
implementation 'com.straint:constraint-layout:1.1.2'
implementation 'com.android.support:design:28.0.0-alpha3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.st:runner:1.0.2'
androidTestImplementation 'com.st.espresso:espresso-core:3.0.2'
implementation 'de.hdodenhof:circleimageview:2.1.0'
implementation 'com.github.bumptech.glide:glide:3.8.0'
implementation 'ing:zxing-parent:3.3.3'
implementation 'com.lzy:okhttputils:+'
compile 'org.xutils:xutils:3.5.0'
compile 'com.amap.api:3dmap:latest.integration'
compile 'com.amap.api:location:latest.integration'
}
(1)第⼀⾏应⽤了⼀个插件,⼀般有两种值可选:com.android.application表⽰是⼀个应⽤程序模块,com.android.library表⽰是⼀个库模块。应⽤程序模块和库模块的最⼤区别在于,⼀个是可以直接运⾏,⼀个只能作为代码库依附于别的应⽤程序模块来运⾏
(2)android闭包,这个闭包中可以配置项⽬构建的各种属性:
  complieSdkVersion⽤于指定项⽬的编译版本,这个指定成24表⽰使⽤Android 7.0系统的SDK编译;
  buildToolsVersion⽤于指定项⽬构建⼯具的版本,当前使⽤的是24.0.2;
  android闭包中嵌套了⼀个defaultConfig闭包,defaultConfig闭包中可以对项⽬的更多细节进⾏配置:
    applicationId⽤于指定项⽬的包名;
    minSdkVersion⽤于指定项⽬最低兼容的Android版本,这⾥指定成15表⽰最低兼容到Android 4.0系统;
    targetSdkVersion指定的值表⽰在该⽬标版本上已经做了充分的测试,系统将会为你的应⽤程序启⽤⼀些最新的功能和特性,如;
    versionCode⽤于指定项⽬的版本号;
    versionName⽤于指定项⽬的版本名;
    testInstrumentationRunner表⽰采⽤的测试框架;
(3)buildType闭包⽤于指定⽣成安装⽂件的相关配置,通常只会有两个⼦闭包,⼀个是debug,⼀个是relea。debug闭包⽤于指定⽣成测试版本安装⽂件的配置,relea闭包⽤于指定⽣成正式版本安装⽂件的配置。
  minifyEnabled⽤于指定是否对项⽬的代码进⾏混淆,true表⽰混淆,fal表⽰不混淆;
型号翻译
  proguardFile⽤于指定混淆时使⽤的规则⽂件,这⾥指定了两个⽂件,第⼀个是在Android SDK⽬录下的,⾥⾯是所有项⽬通⽤的混淆规则,第⼆个proguard-rules.pro是在当前项⽬的根⽬录下的,⾥⾯可以编写当前项⽬特有混淆规则。camelbak
(4)dependencies闭包,指定当前项⽬所有依赖。Android Studio项⽬共有3种依赖⽅式:本地依赖,库依赖和远程依赖。

本文发布于:2023-06-30 19:25:50,感谢您对本站的认可!

本文链接:https://www.wtabcd.cn/fanwen/fan/90/162895.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:指定   配置   版本   代码   模块   依赖   安装
相关文章
留言与评论(共有 0 条评论)
   
验证码:
Copyright ©2019-2022 Comsenz Inc.Powered by © 专利检索| 网站地图