[笔记] Android开发中的gradle是什么?
- gradle是什么?
先看下文档中的介绍 https://docs.gradle.org/current/userguide/what_is_gradle.html
Gradle is an open-source build automation tool that is designed to be flexible enough to build almost any type of software.
gradle是开源的自动编译工具,可以方便自由的编译任何软件。
然后进行了一些笼统的介绍,其中提到了一些需要注意的地方,贴出来如下,感觉这个提醒短期内也用不到。
The most notable restriction is that dependency management currently only supports Maven- and Ivy-compatible repositories and the filesystem.
最需要注意的一点是依赖包管理目前只支持Maven- and Ivy-compatible repositories and the filesystem。
- 用gradle编译一个Android实例
参考https://docs.gradle.org/current/samples/sample_building_android_apps.html
贴出来如下:
Building Android Apps Sample
This sample shows how a simple Android application written in Java can be built with Gradle. The application was created following the Build your first app guide.
plugins {
id('com.android.application') version '7.1.1'
}
repositories {
google()
mavenCentral()
}
android {
compileSdkVersion 30
defaultConfig {
applicationId 'org.gradle.samples'
minSdkVersion 16
targetSdkVersion 30
versionCode 1
versionName '1.0'
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
testImplementation 'junit:junit:4.13.1'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}
To build the application:
$ ./gradlew build
For more information, we suggest reading Getting Started with Gradle. You can also find Android development related information inside the guides provided by the Android team.
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 终于写完轮子一部分:tcp代理 了,记录一下
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 别再用vector<bool>了!Google高级工程师:这可能是STL最大的设计失误
· 单元测试从入门到精通
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理