ghedeon
08/14/2019, 8:55 PMmbonnin
08/14/2019, 9:02 PMghedeon
08/14/2019, 9:09 PMpackage com.foo;
public class Fun {
public static void sayHello() {
System.out.println("Hello");
}
}
Usage:
task hello {
doLast {
com.foo.Fun.sayHello()
}
}
That works. Once I convert Fun
to kotlin it can't import it anymore.mbonnin
08/14/2019, 10:05 PMbuildSrc/build.gradle
?ghedeon
08/14/2019, 10:10 PMplugins {
kotlin("jvm") version '1.3.31'
}
dependencies {
implementation gradleApi()
compile(kotlin("stdlib-jdk8"))
}
gildor
08/14/2019, 11:09 PMplugins {
id "org.gradle.kotlin.kotlin-dsl" version "1.2.10"
}
kingsley
08/15/2019, 8:09 AM@JvmStatic
on that method, so the Groovy buildscript doesn’t see it as a static Fun.sayHello()
anymoregildor
08/15/2019, 8:35 AMghedeon
08/16/2019, 11:25 AMbuild.gradle
? Because the later gives me NoClassDefFoundError: org/gradle/kotlin/dsl/support/KotlinDslPluginsKt
gildor
08/16/2019, 11:26 AMghedeon
08/16/2019, 11:30 AMobject deps {
val multidex = "androidx.multidex:multidex:2.0.1"
}
I expect this to be visible in any of my build.gradle
files as implementation deps.multidex
. But it's not...louiscad
08/16/2019, 11:42 AMbuild.gradle
scripts, but it is fixed in 3.5 now in RC. (That bug kicked-off my migration to Gradle Kotlin DSL)ghedeon
08/16/2019, 11:45 AMlouiscad
08/16/2019, 11:53 AMghedeon
08/16/2019, 11:57 AMdeps.foo
actually brings you to your kotlin file in buildSrc. I'm wondering what people that answered "YES" do...louiscad
08/16/2019, 12:11 PMmbonnin
08/16/2019, 12:40 PMapp/build.gradle
there https://github.com/HearthSim/Arcane-Tracker/blob/bdf01d728d5eddefba68f76e5da155620f480d00/app/build.gradle#L1gildor
08/16/2019, 12:47 PMI expect this to be visible in any of myWhy do you expect that it will work? Groovy is not Kotlin, you have to use Java syntax, something like:files asbuild.gradle
. But it's not...implementation deps.multidex
deps.INSTANCE.getMultidex()
, or use JvmStatic insteadmbonnin
08/16/2019, 12:51 PMmultidex
const ?object Libs {
const val supportLibVersion = "28.0.0"
}
Kotlin bytecode shows: public final class Libs {
// access flags 0x19
public final static Ljava/lang/String; supportLibVersion = "28.0.0"
@Lorg/jetbrains/annotations/NotNull;() // invisible
gildor
08/16/2019, 12:55 PMghedeon
08/16/2019, 1:07 PMgildor
08/16/2019, 1:07 PMghedeon
08/16/2019, 1:08 PMgildor
08/16/2019, 1:08 PMghedeon
08/16/2019, 1:08 PMobject deps
--> object Deps
gildor
08/16/2019, 1:12 PMghedeon
08/16/2019, 1:12 PMgildor
08/16/2019, 1:12 PMghedeon
08/16/2019, 1:12 PMdeps
does't existsgildor
08/16/2019, 1:13 PMghedeon
08/16/2019, 1:14 PMgildor
08/16/2019, 1:17 PMghedeon
08/16/2019, 1:24 PMlouiscad
08/16/2019, 1:26 PMgildor
08/16/2019, 1:28 PMIt’s an essential part of the android developmentYeah, same as huge amount of other technologies, and at least Gradle can be avoided if you really know what are you doing