首页 > 其他分享 >[笔记] Android开发中的gradle是什么?

[笔记] Android开发中的gradle是什么?

时间:2022-11-13 16:57:49浏览次数:69  
标签:androidx 笔记 gradle application build android Android

  • 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.

Groovy中gradle的内容为 app/build.gradle :  
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.

 

标签:androidx,笔记,gradle,application,build,android,Android
From: https://www.cnblogs.com/heweiren-cheng/p/16886168.html

相关文章

  • 网络流学习笔记
    基础知识定义网络\(G=(V,E)\)为有向图,边上有一权值\(c(x,y)\)为边的容量,有\(\forall(x,y)\notinE,c(x,y)=0\)。设定两个特殊的节点\(S\)源点和\(T\)......
  • 使用JAX构建强化学习agent并借助TensorFlowLite将其部署到Android应用中
    在之前发布文章《一个新TensorFlowLite示例应用:棋盘游戏》中,展示了如何使用TensorFlow和TensorFlowAgents来训练强化学习(RL)agent,使其玩一个简单棋盘游戏“Pl......
  • 《Unix/Linux系统编程》第十一周学习笔记
    《Unix/Linux系统编程》第十一周学习笔记TCP/IP协议TCP/IP是互联网的基础。TCP代表传输控制协议。IP代表互联网协议。目前有两个版本的IP,即IPv4和IPv6。IPv4使用32位......
  • Android Studio Dolphin 稳定版正式发布
     作者/YuriBlaise,ProductManager,Android为了帮助开发者们更轻松地打造高质量应用,AndroidStudio 团队深入调研,为大家带来了最新稳定版AndroidStudioDolphi......
  • 微服务笔记之Eureka03(服务续约分析)
    服务续约接口分析com.netflix.eureka.resources.InstanceResource#renewLeasepublicResponserenewLease(@HeaderParam(PeerEurekaNode.HEADER_REPLICATIO......
  • 微服务笔记之Eureka03
    服务注册接口源码分析:com.netflix.eureka.resources.ApplicationResource#addInstancepublicResponseaddInstance(InstanceInfoinfo,......
  • CDGA数据治理工程师认证教程视频笔记真题答案下载 CDGA培训视频考试题库备考2023必过
     一、前言 1、关于DAMA国际数据管理协会(DAMA国际)是一个全球性的专业组织(类似于PMP证书的PMI项目管理协会),由数据管理和相关的专业人士组成,协会自1980年成立以来,一直致力......
  • 多线程编程学习笔记文章目录
     多线程编程学习笔记-基础(一)多线程编程学习笔记-基础(二)多线程编程学习笔记-基础(三) 多线程编程学习笔记——线程同步(一)多线程编程学习笔记——线程同步(二) 多线......
  • MySQL基础笔记
    目录创建和查看数据库2修改和查看数据库字符集2创建表createtable+表名5删除表droptable+表名6展示创建表格showcreatetablecustomer;8复制表格create......
  • 学习笔记——双连通分量
    前言我们的神,MC曾经曰过,Tarjan是\(11\)级算法。边双桥:在一张连通无向图中,如果去掉一条边使得图的极大连通分量增加了,那么这条边就叫做桥。边双连通分量:一张无......