当前位置: 首页 > news >正文

自己做淘宝网站舆情视频

自己做淘宝网站,舆情视频,外贸网站建设模板,网站如何做网站名称Gradle 参考官方文档:https://developer.android.com/studio/build?hlzh-cn#groovy settings.gradle 存放于项目根目录下,此设置文件会定义项目级代码库设置,并告知 Gradle 在构建应用时应将哪些模块包含在内 接下来将以一个简单的 settin…

Gradle

参考官方文档:https://developer.android.com/studio/build?hl=zh-cn#groovy


settings.gradle

存放于项目根目录下,此设置文件会定义项目级代码库设置,并告知 Gradle 在构建应用时应将哪些模块包含在内

接下来将以一个简单的 settings.gradle 文件,详细讲述对应常见配置项及其作用

// 依赖管理
// 定义远程或者本地仓库位置,gradle将会从这些仓库搜索并下载对应依赖以及相关内容
pluginManagement {// 定义仓库repositories {gradlePluginPortal()google()                // google官方仓库mavenCentral()          // maven中心仓库,替代老版本的JCenter}// 定义解决方案,即对所下载的依赖做出的处理resolutionStrategy{eachPlugin{if (requested.id.id == 'dagger.hilt.android.plugin'){useModule("com.google.dagger:hilt-android-gradle-plugin:2.38.1")}}}
}// 定义所有模块的仓库位置
// 这是一项全局配置,对于单个模块仍然需要定义自己的build.gradle来设置!
dependencyResolutionManagement {repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)repositories {google()mavenCentral()}
}// 根工程名称(即你创建该android项目时的名字)
rootProject.name = "Character"
// 定义模块目录所在位置
include ':app'

build.gradle(project:app)

文件存在于于根目录下,是整个项目的顶层 build.gradle

该 gradle 一般用来定义全局变量、依赖地址以及相关的清理操作

// 构建脚本
buildscript {// 定义全局变量,常用于版本管理// 变量在子模块的build.gradle中直接以: $NAME 的形式调用ext {compose_version = '1.0.1'lifecycleVersion = '2.3.1'kotlinVersion = '1.5.21'ktlintVersion = '0.41.0'coroutines = '1.5.0'moshi_version = '1.12.0'}
}// 依赖URL
// 之前于settings.gradle定义的是整体的仓库位置,而这里可以视为定义具体的依赖位置
// plugins定义项目中所有模块共用的 Gradle 依赖项
// apply false 不可以用于子模块的build.gradle
plugins {id 'com.android.application' version '7.1.0-rc01' apply falseid 'com.android.library' version '7.1.0-rc01' apply falseid 'org.jetbrains.kotlin.android' version '1.5.21' apply false
}// 定义清理build目录的对应方法
task clean(type: Delete) {delete rootProject.buildDir
}

build.gradle(module:app)

存在于 app 文件夹下(即模块专属 gradle)

这里选用了油管上一个 MVVM 练手项目的 build.gradle 文件,可以前往github查看该项目

// 子模块的plugins
// 请注意!这里就不可以定义apply false了
plugins {id 'com.android.application'id 'org.jetbrains.kotlin.android'id 'dagger.hilt.android.plugin'
}// 应用插件 Kapt
// 这是一款kotlin专用的依赖管理插件,推荐每个项目都添加!
apply plugin: 'kotlin-kapt'// android
// 定义所有模块构建设置
android {// 定义编译SDK// 表示你的项目可以使用低于(或等于)该版本的所有APIcompileSdk 32// 定义默认配置defaultConfig {// 工件IDapplicationId "com.example.character"// 最低可接受SDK版本minSdk 21// 最高可接受SDK版本targetSdk 32// 给开发者看的项目版本versionCode 1// 给客户看的项目版本versionName "1.0"testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"vectorDrawables {useSupportLibrary true}}// 定义构建类型// 默认的构建类型有两种:debug(构建时会默认打上debug签名) release(构建时默认不打任何签名)buildTypes {release {minifyEnabled falseproguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'}}// 如果你用的是JDK8,那么请添加这个两个配置以提供支持compileOptions {sourceCompatibility JavaVersion.VERSION_1_8targetCompatibility JavaVersion.VERSION_1_8}kotlinOptions {jvmTarget = '1.8'}// 构建特性buildFeatures {compose true}// compose设置composeOptions {kotlinCompilerExtensionVersion compose_version}// 资源文件配置packagingOptions {resources {excludes += '/META-INF/{AL2.0,LGPL2.1}'}}
}// 在这里直接把你需要添加的依赖贴进去就好了
// 贴完后点sync即可
dependencies {implementation 'androidx.core:core-ktx:1.7.0'implementation "androidx.compose.ui:ui:$compose_version"implementation "androidx.compose.material:material:$compose_version"implementation "androidx.compose.ui:ui-tooling-preview:$compose_version"implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.3.1'implementation 'androidx.activity:activity-compose:1.3.1'testImplementation 'junit:junit:4.13.2'androidTestImplementation 'androidx.test.ext:junit:1.1.3'androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_version"debugImplementation "androidx.compose.ui:ui-tooling:$compose_version"// dagger -hiltimplementation "com.google.dagger:hilt-android:2.38.1"kapt "com.google.dagger:hilt-android-compiler:2.38.1"kapt "androidx.hilt:hilt-compiler:1.0.0"// Lifecycle componentsimplementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycleVersion"implementation "androidx.lifecycle:lifecycle-viewmodel-compose:2.4.0"implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycleVersion"implementation "androidx.lifecycle:lifecycle-common-java8:$lifecycleVersion"// Kotlin componentsimplementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion"implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines"// networkingimplementation 'com.squareup.retrofit2:retrofit:2.9.0'implementation 'com.squareup.retrofit2:converter-moshi:2.9.0'implementation("com.squareup.okhttp3:okhttp:4.9.0")implementation("com.squareup.okhttp3:logging-interceptor:4.9.0")implementation "com.squareup.moshi:moshi-kotlin:$moshi_version"kapt "com.squareup.moshi:moshi-kotlin-codegen:$moshi_version"// coilimplementation("io.coil-kt:coil-compose:1.4.0")
}

三大主要文件全部讲完了,后续将提供打包过程以及对应签名等内容


http://www.hkea.cn/news/490827/

相关文章:

  • 销售管理系统需求分析长沙seo代理
  • 站长网站查询深圳百度关键字优化
  • 用net语言做网站平台好不好企业培训师资格证报考2022
  • 成都定制网站设竞价推广遇到恶意点击怎么办
  • 制作视频网站建设友链交易网
  • 做外贸是不是要有网站腾讯企点app下载安装
  • 网站开发快递文件国外网站怎么推广
  • 网站和搜索引擎站长论坛
  • 做违法网站会怎样外贸独立站怎么建站
  • 云主机建网站教程深圳全网推互联科技有限公司
  • 做网站赚50万谷歌搜索引擎363入口
  • 台州网站设计外包网页制作公司排名
  • 网站建设投标文件范本亚马逊提升关键词排名的方法
  • 学做网站需要多长时间免费推广平台排行
  • wordpress运行php 404360优化大师下载
  • seo排名网站 优帮云线上推广的三种方式
  • 平凉哪有做网站的百度推广登录入口官网网
  • 娄底网站优化自建网站平台有哪些
  • 做网站需要多少兆空间wix网站制作
  • 哪些网站教做生物实验今日新闻联播
  • 铜川市住房和城乡建设局网站信息流广告哪个平台好
  • 太原市建设交易中心网站首页百度手机助手app安卓版官方下载
  • 昆山网站建设网站建设郑州网络推广哪个好
  • 瑜伽网站设计国外推广网站
  • 什么网站做国外批发百度推广自己怎么做
  • 网站管理工具百度推广可以自己开户吗
  • 三水网站制作中山做网站推广公司
  • ysl网站设计论文郑州seo地址
  • 做食品的网站设计要注意片多多可以免费看电视剧吗
  • 网站排名推广自己怎么做长沙seo代理商