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

网站搜索条怎么做软件工程师工作内容

网站搜索条怎么做,软件工程师工作内容,外贸销售是做什么工作的,wordpress 注册超时文章目录 变量定义函数定义函数调用闭包参数APK输出配置多channel配置依赖配置关键总结常见混淆点groovy高度兼容java 变量定义 def debugCdnUrl "\"http://xxx\"" //变量赋值函数定义 def getTime() { // 函数定义(def 是 Groovy 中定义变…

文章目录

  • 变量定义
  • 函数定义
  • 函数调用
  • 闭包参数
  • APK输出配置
  • 多channel配置
  • 依赖配置
  • 关键总结
  • 常见混淆点
  • groovy高度兼容java

变量定义

def debugCdnUrl = "\"http://xxx\"" //变量赋值

函数定义

def getTime() {  // 函数定义(def 是 Groovy 中定义变量/函数的关键字)return new Date().format("yyyyMMdd", TimeZone.getDefault())
}

函数调用

apply plugin: 'com.android.application'  // apply 是方法,参数是一个 Map
// (plugin: 'com.android.application' 等价于 [plugin: 'com.android.application'])println "hello world"  // 方法调用(Groovy的 println)signingConfigs {  // 方法调用(接收闭包参数)debug {  // 方法调用(配置 debug 签名)storeFile file('..\\myKey\\xxxKey.jks')  // 方法调用(storeFile 是方法,参数是 file() 的返回值)keyPassword '123456'  // 方法调用(参数字符串)// ...其他同理}
}buildTypes {  // 方法调用debug {  // 方法调用(配置 debug 类型)signingConfig signingConfigs.debug  // 方法调用(参数是 signingConfigs.debug 的返回值)minifyEnabled false  // 方法调用(参数布尔值)buildConfigField("String", "app_key", "\"${app_key}\"")  // 方法调用(三个参数)}
}

闭包参数

android {  // 方法调用(接收闭包参数)compileSdkVersion 30        // 方法调用(参数30)buildToolsVersion '28.0.3'   // 方法调用(参数字符串)useLibrary 'org.apache.http.legacy'  // 方法调用(参数字符串)defaultConfig {  // 方法调用(接收闭包参数)applicationId "com.jy.demo"      // 方法调用(参数字符串)minSdkVersion 21                 // 方法调用(参数21)targetSdkVersion 30              // 方法调用(参数30)// ...其他类似}sourceSets {  // 方法调用(接收闭包参数)main {  // 方法调用(配置 main 的 source set)jniLibs.srcDir 'libs'  // 方法调用(jniLibs 是对象,srcDir 是方法)}// ...其他channel配置同理}
}

APK输出配置

applicationVariants.all { variant ->  // 方法调用(all 是方法,参数是闭包)def buildType = variant.buildType.name  // 属性访问(variant.buildType 是对象,name 是属性)variant.getPackageApplicationProvider().get().outputDirectory = ...  // 方法调用链(getPackageApplicationProvider() 返回对象,再调用 get())variant.outputs.each {  // 方法调用(each 是 Groovy 的迭代方法)it.outputFileName = ...  // 属性赋值(it 是 outputs 的元素,outputFileName 是属性)}
}

多channel配置

flavorDimensions "channel", 'cdn'  // 方法调用(两个字符串参数)
productFlavors {  // 方法调用(接收闭包参数)p_xxx {  // 方法调用(创建名为 p_xxx 的 flavor)dimension "channel"  // 方法调用(参数字符串)applicationId "com.xxx.demo"  // 方法调用(参数字符串)buildConfigField "String", "apkUpdateUrl", '"..."'  // 方法调用(三个参数)《注入字段》}// ...其他同理
}

依赖配置

dependencies {  // 方法调用(接收闭包参数)p_xxxImplementation fileTree(...)  // 方法调用(p_xxxImplementation 是方法名,参数是 fileTree 的返回值)    p_pftestImplementation fileTree(include: ['*.jar', '*.aar'], dir: 'gamelibs') //demo of previous lineimplementation 'androidx.appcompat:appcompat:1.3.1'  // 方法调用(implementation 是方法,参数字符串)
}

关键总结

  • 方法调用:Groovy 允许省略括号,例如 compileSdkVersion 30 等价于 compileSdkVersion(30)
  • 闭包参数:类似 android { … } 的结构,android 是方法,后面的 { … } 是闭包参数
  • 属性赋值:当代码直接形如 key = value 时(例如 it.outputFileName = …),这是真正的属性赋值。
  • DSL 魔法:Gradle 通过 Groovy 的 methodMissing 和 propertyMissing 机制,将未定义的方法/属性转换为配置项。

常见混淆点

// buildConfigField:看似是属性,实则是方法,接受三个参数(类型、字段名、值)。// manifestPlaceholders:是方法调用(manifestPlaceholders = [ ... ]),参数是一个 Map。// jniLibs.srcDir 'libs':jniLibs 是对象,srcDir 是方法,参数是路径。

groovy高度兼容java

  • 在 build.gradle 文件中,可以直接使用 Java 代码的语法,因为 Groovy(Gradle 的默认 DSL 语言)与 Java 高度兼容。
  • 总的来说:可以使用java语法、调用java库;但是更推荐优先使用groovy语法和gradle的DSL特性。

文章转载自:

http://DsCdhDzF.ghcfx.cn
http://vgVea7Nt.ghcfx.cn
http://pwd9cesQ.ghcfx.cn
http://3zrUjE1F.ghcfx.cn
http://plvFZHqR.ghcfx.cn
http://rwO0Xydl.ghcfx.cn
http://ANeDUjyv.ghcfx.cn
http://OjeQdhe1.ghcfx.cn
http://0sAoiAjH.ghcfx.cn
http://JC4bD6Dc.ghcfx.cn
http://JQnFzi3N.ghcfx.cn
http://WF2kmzN3.ghcfx.cn
http://TGyBUrPk.ghcfx.cn
http://EuyU4i9U.ghcfx.cn
http://oIrush0p.ghcfx.cn
http://5s0VkXQu.ghcfx.cn
http://k0BfU2eg.ghcfx.cn
http://ewW5HvBR.ghcfx.cn
http://TRUhfuTC.ghcfx.cn
http://hcFelBCy.ghcfx.cn
http://unT0uZBt.ghcfx.cn
http://TmpFK3QR.ghcfx.cn
http://WxqPSxRI.ghcfx.cn
http://WYDml2e0.ghcfx.cn
http://gvbg3J6g.ghcfx.cn
http://BeYr3KVe.ghcfx.cn
http://sevix7VN.ghcfx.cn
http://DkMM25nV.ghcfx.cn
http://EdGXOaNE.ghcfx.cn
http://1gNl1QSw.ghcfx.cn
http://www.dtcms.com/wzjs/724584.html

相关文章:

  • 层次结构分明的网站配色方案国内网站排名
  • 用dw做网站首页360指数查询工具
  • 做网站推广的方法有哪些玉林做绿化苗木网站的是哪个单位
  • 凡科建站是放在哪个服务器上广告插件wordpress移动端
  • 外国人做外贸都会浏览哪些网站宁波seo优化
  • 宣城网站开发网络公司网页设计构思
  • 制作网站的列子移动网站 pc网站的区别
  • 网站栏目优化query post wordpress
  • 商务网站建设步骤有几个做网站编辑要会什么
  • 网站建设 工具seo交流论坛seo顾问
  • 公司手机网站建设怎样做电影下载网站
  • 深圳卓富通做网站酷家乐设计官网
  • 青岛通力建设集团网站关于建设网站的报告
  • 建筑工地网站网站策划制作公司
  • 做标书需要用到哪些网站查资料怀化网站制作
  • 西安网站建设公营销型网站建设的关键特点
  • 文明网站建设培训体会专业团队图片张伟
  • 视频网站后台登陆做vi的设计公司
  • 天津做网站的费用网站备案域名更改
  • 广州外贸网站公司国外网站ip地址
  • 快站优惠券29网站建设全部
  • 扬州高邮网站建设wordpress发布文章附件
  • 在线营销单页网站制作织梦网站描述
  • 做固定背景网站天元建设集团有限公司技术中心
  • 南昌住房建设局网站05网数学
  • 专门做食品的网站任丘建设网站制作
  • 赣州网站建设-赣州做网站中国建设招标网是个假网站
  • 10个网站 云主机需求专业零基础网站建设教学培训
  • 诸城网站开发关于网站开发的开题报告
  • 如何提升做网站的效率网站推广软件免费版