How do I use the native JUnit 5 support in Gradle with the Kotlin DSL?

[Edit april 2019] As Pedro has found, three months after I asked this question Gradle actually created a user guide for the Kotlin DSL which can be visited at https://docs.gradle.org/current/userguide/kotlin_dsl.html They also added a migration guide from Groovy to Kotlin at https://guides.gradle.org/migrating-build-logic-from-groovy-to-kotlin/ Answer: The syntax you ask for is tasks.test { // Use the built-in … Read more

How to access variant.outputFileName in Kotlin

A little simplified version of @david.mihola answer: android { /** * Notes Impl: Use DomainObjectCollection#all */ applicationVariants.all { val variant = this variant.outputs .map { it as com.android.build.gradle.internal.api.BaseVariantOutputImpl } .forEach { output -> val outputFileName = “YourAppName – ${variant.baseName} – ${variant.versionName} ${variant.versionCode}.apk” println(“OutputFileName: $outputFileName”) output.outputFileName = outputFileName } } }

What is the difference between registering and creating in Gradle Kotlin DSL

See using the container API: tasks.named(“check”) tasks.register(“myTask1”) tasks.named<JavaCompile>(“compileJava”) tasks.register<Copy>(“myCopy1”) The above sample relies on the configuration avoidance APIs. If you need or want to eagerly configure or register container elements, simply replace named() with getByName() and register() with create(). Difference between creating and registering (or create and register in Gradle versions prior to 5.0) is … Read more

Plugin [id: ‘dagger.hilt.android.plugin’] was not found in any of the following sources

I am late for the answer. I was also facing the same problem in Android Studio Bumblebee because of the new Gradle syntax for adding dependencies at the project level. For adding Dagger Hilt in project-level you can use the following syntax: id ‘com.google.dagger.hilt.android’ version ‘2.41’ apply false At the time of writing this, the … Read more

Gradle Kotlin DSL: Define Kotlin version in unique place

In later versions of Gradle you no longer need to specify the version of your kotlin(stdlib|reflect|test) dependencies, the Kotlin plugin will automatically configure them for you. As for extracting the dependency to a single place, there are two main patterns: define the constants you want to share in an object within buildSrc/src/main/kotlin/ and use that … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)