Questions tagged [gradle-kotlin-dsl]

Kotlin language support for Gradle build scripts.

Gradle build scripts have historically been written in Groovy. The Gradle Kotlin DSL project was created to create statically typed, clear, concise,and descriptive build scripts with awesome IDE support.

Build scripts are written in the Kotlin programming language, but using a Kotlin DSL (domain specific language) designed specifically to support building software.

Questions that belong here:

  • What causes a specific build script error?
  • How to convert a specific construct of a Groovy build script to its Kotlin equivalent?
  • How to achieve a specific processing task in your Kotlin build script?

Do not use this tag for general gradle questions.

Note: Before version 0.10.1 the "Gradle Kotlin DSL" project was called "Gradle Script Kotlin".

1145 questions
0
votes
3 answers

add a value 10 times and divide it into 10 in kotlin

How to enter a value in kotlin and have it added 10 times and then divided into 10 using a flow (while) control. This is my code: calcular.setOnClickListener { if (et_valor.text.isEmpty()) Toast.makeText(this, "Debe…
0
votes
1 answer

control flow (while): I need to apear in my virtual device

i'm to learning programing in kotlin and i practicing with the control flow (wile), the problem is that i want to appear ten number in my virtual device and just appear one. This is the my code: class MainActivity : AppCompatActivity() { override…
0
votes
1 answer

Error while passing jmeter simple configuration in build.gradle.kts

While trying to pass simple configuration in build.gradle.ktl file for running jmeter gradle. plugin (https://github.com/jmeter-gradle-plugin/jmeter-gradle-plugin/wiki/Getting-Started) I am trying to pass simple configuration and my build.gradle.kts…
Anmol Dubey
  • 115
  • 2
  • 13
0
votes
1 answer

Kotlin, Gradle - Unable to run file NoClassDefFoundError

Im trying to compile and run by my own hands, but I have problem. Im using Intellij IDEA, Kotlin and Gradle. First, I built project (and made .class file), next, in IDE Terminal I typed "gradle build" (this make me .jar file). When Im trying to run…
CospriMalice
  • 13
  • 1
  • 3
0
votes
2 answers

How to enable viewBinging in android project using Kotlin gradle dsl?

android { ...I'm trying to enalbe ViewBinding in my project witch use Kotlin Gradle DSL. All examples show how to do it with Groovy DSL. android { ... viewBinding { enabled = true } } But this solution isn't works with…
0
votes
1 answer

Gradle: Reading variable block from subproject in root project task

I have been looking into how to define a block of variables in a small number of subprojects build.gradle.kts, and read these blocks from a task defined in the root project build.gradle.kts. SubProject1 build.gradle.kts dependencies { …
MeanwhileInHell
  • 6,780
  • 17
  • 57
  • 106
0
votes
1 answer

Gradle / Kotlin - overriding extra property in subprojects to control common project task

There's a lot of other related questions on this, but I haven't been able to get anything working here. I'm using shadowjar in a subset of my subprojects to product a far jar. One of the subprojects produces two jars (different main class). I'm…
fridgepolice
  • 349
  • 2
  • 12
0
votes
2 answers

How do you combine multiple gradle flavors or exclude one?

flavorDimensions("color") productFlavors { register("red") { setDimension("color") } register("blue") { setDimension("color") } } redImplementation("red library") blueImplementation("blue library") This generates…
0
votes
1 answer

Is there a way to make gradle task lintRelease do nothing when executed for a particular module?

Currently lintRelease, task depends on the compilation task, and for some modules (which I dont care about since its only used for testing purposes), I want lintRelease to do nothing, just print Not supported is that possible with gradle…
Bhargav
  • 8,118
  • 6
  • 40
  • 63
0
votes
2 answers

App Keeps Crashing When I'm trying to add two editext

please the app keeps crashing on my phone when i try to add the values of two edit text in android studio i've tried all i can changing the data types package com.example.danculator import androidx.appcompat.app.AppCompatActivity import…
BlackDante101
  • 81
  • 2
  • 8
0
votes
2 answers

GString lazy evaluation in Kotlin DSL using gradle-git-properties plugin

I'm using Gradle 6.2.2 with this plugin: com.gorylenko.gradle-git-properties (version 2.2.2). I'm trying to "translate" the following snippet into Kotlin DSL: gitProperties { extProperty = "gitProps" // git properties will be put in a map at…
x80486
  • 6,627
  • 5
  • 52
  • 111
0
votes
1 answer

Can not ready file text within build.gradle.kts

I am trying to print a kotlin class before compiling it to generate another class. I tried many methods to be sure about printing the file text before compiling it through File.readText() but nothings success-ed always printing code joined with…
0
votes
1 answer

Unable to find method 'org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension.macosX64()

I've updated kotlin from 1.3.61 to 1.3.70 in my multiplatform project with android, jvm, ios and macosx64 targets not changing other code and whenever a gradle sync is attempted I get the following message (and the project build fails, of…
Overpass
  • 433
  • 5
  • 12
0
votes
2 answers

What is the recommended way to group dependencies of the same type?

I'd like to separate the dependencies in my project by type, and am considering doing so in the following way: // Implementation dependencies dependencies { implementation("foo:bar:1") { because("reason 1") } …
Kevin
  • 2,617
  • 29
  • 35
0
votes
1 answer

How to convert this subprojects section from a groovy gradle file to a kotlin kts file?

New to Gradle, Groovy and Kotlin and having trouble translating a groovy based gradle file to a kotlin based one. https://github.com/square/okio/issues/647 How would I translate this below to Kotlin for a build.gradle.kts? subprojects { subProject…
MonkeyBonkey
  • 46,433
  • 78
  • 254
  • 460