You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Android Studio Hedgehog中potpourri模块的Gradle Kotlin等价写法

Groovy版Gradle转Kotlin版(针对potpourri模块)

1. 模块级build.gradle.kts中的依赖配置

对应的Kotlin语法依赖代码如下:

dependencies {
    implementation(files("libs/jsch-0.1.54.jar"))
    implementation(project(":potpourri"))
}

2. settings.gradle.kts中的模块引入配置

对应的Kotlin语法代码如下:

include(":app")
include(":potpourri")

project(":potpourri").projectDir = File(settingsDir, "../Potpourri/app")

转换关键点

  • Groovy中无需括号的函数调用,在Kotlin DSL里要显式添加括号
  • Kotlin创建File实例不用new关键字,直接调用构造方法即可
  • 字符串用双引号即可,和Groovy用法一致

内容的提问来源于stack exchange,提问作者Kevin Gilbert

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.03 06:39:54