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

淄博建设网站企业网站首页

淄博建设网站,企业网站首页,怎样做网站策划,怎么做整人网站一、编译配置 1、Android中的配置 使用如下方式开启在Android中的gradle的kotlin编译配置: 该配置在其余平台不可用 android {...compileOptions {sourceCompatibility JavaVersion.VERSION_17targetCompatibility JavaVersion.VERSION_17}kotlinOptions {jvmTar…

一、编译配置

1、Android中的配置

使用如下方式开启在Android中的gradle的kotlin编译配置:
该配置在其余平台不可用

android {...compileOptions {sourceCompatibility JavaVersion.VERSION_17targetCompatibility JavaVersion.VERSION_17}kotlinOptions {jvmTarget = '1.8'
//        freeCompilerArgs.add("-Xexport-kdoc")setFreeCompilerArgs(["-Xcontext-receivers"])
//setFreeCompilerArgs(["-Xexport-kdoc","-Xcontext-receivers","-opt-in=org.mylibrary.OptInAnnotation"])}//如下方式会报错//tasks.withType(KotlinCompile::class).all {
//    kotlinOptions.freeCompilerArgs = listOf("-Xcontext-receivers")
//}...}

以上配置会开启Kotlin/JVM 的上下文接收者原型功能,否则该功能不可用,开启后编码可以使用以下代码:

interface LoggingContext {val log: Logger // This context provides a reference to a logger 
}context(LoggingContext)
fun startBusinessOperation() {// You can access the log property since LoggingContext is an implicit receiverlog.info("Operation has started")
}fun test(loggingContext: LoggingContext) {with(loggingContext) {// You need to have LoggingContext in a scope as an implicit receiver// to call startBusinessOperation()startBusinessOperation()}
}

传递参数的发过誓可以直接在里面写setFreeCompilerArgs(["-opt-in=org.mylibrary.OptInAnnotation"])

2、其余平台的配置

除了上述配置还可以使用以下配置,该配置可以在其余平台使用:

android {
}
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {sourceCompatibility = JavaVersion.VERSION_1_8targetCompatibility = JavaVersion.VERSION_1_8kotlinOptions {jvmTarget = '1.8'apiVersion = '1.1'languageVersion = '1.1'}
}

二、参考链接:

  1. Kotlin 1.6.20 的新特性
  2. Kotlin Gradle plugin 中的编译器选项
  3. IDE highlighting: False positive error “Context receivers should be enabled explicitly”
  4. compileKotlin block in build.gradle file throws error “Could not find method compileKotlin() for arguments […]”
http://www.hkea.cn/news/587766/

相关文章:

  • wordpress建好站了打不开首页成都关键词优化排名
  • 京东网站开发需求如何做谷歌优化
  • 微信app开发诊断网站seo现状的方法
  • 做旅行网站网站seo优化多少钱
  • 上海专业网站建设咨询网络销售怎么样
  • 奶茶网页设计图片湖南seo网站多少钱
  • 家里电脑做网站服务器如何建立网址
  • 临西做网站哪里便宜seo专业培训课程
  • 高端网站设计报价表个人网上卖货的平台
  • 广州网站优化推广公司网站优化排名资源
  • 济南网站建设大标网络企业seo服务
  • net域名大网站东莞关键词自动排名
  • 做企业平台的网站怎样进行网络营销吸引顾客
  • 天河网站 建设seo信科分公司谷歌搜索引擎网址
  • 西安网站建设招骋外贸如何推广
  • 网站改版降权武汉seo排名公司
  • 南京哪家公司做企业网站 做得比较好百度seo怎么优化
  • 白云做网站SEO市场营销策略有哪些
  • 做网站用lunx怎么建立一个网站
  • 电商网站开发定制百度推广优化排名
  • 网站备案 法人身份证cba最新消息
  • 做公司网站需要什么手续厦门seo网站优化
  • 合肥本地网站网站关键词公司
  • 武汉电商网站建设seopc流量排行榜企业
  • 如何给给公司建立网站seo商学院
  • 让建站公司做网站需要什么最新腾讯新闻
  • 网站开发的意义搜索关键词排名优化
  • 如何建一个论坛网站怎么做营销推广
  • 元凤建盏简介青岛seo
  • 营销型网站套餐cps游戏推广平台