henrikhorbovyi
06/01/2022, 2:36 PMNoSuchMethod: No Static method setContent
My dependencies:
dependencies {
implementation("androidx.core:core-ktx:1.7.0")
implementation("androidx.compose.ui:ui:1.1.1")
implementation("androidx.compose.material:material:1.1.1")
implementation("androidx.compose.ui:ui-tooling-preview:1.1.1")
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.4.1")
implementation("androidx.activity:activity-compose:1.4.0")
debugImplementation("androidx.compose.ui:ui-tooling:1.1.1")
debugImplementation("androidx.compose.ui:ui-test-manifest:1.1.1")
}
kotlinVersion = "1.6.21"
gradlePluginVersion = "7.2.1"
Oleksandr Balan
06/01/2022, 2:43 PMbuildFeatures
block in your gradle setup?
https://developer.android.com/jetpack/compose/interop/adding#config-gradleAdam Powell
06/01/2022, 2:48 PMsetContent
henrikhorbovyi
06/01/2022, 2:50 PMandroid {
defaultConfig {
minSdk = ANDROID_MIN_SDK_VERSION
compileSdk = ANDROID_COMPILE_SDK_VERSION
versionCode = System.getenv("VERSION_CODE")?.toIntOrNull() ?: 1
versionName = PUBLISHING_VERSION
buildToolsVersion = ANDROID_BUILD_TOOLS_VERSION
}
compileOptions {
sourceCompatibility = VERSION_JAVA
targetCompatibility = VERSION_JAVA
}
sourceSets["main"].java.srcDir("src/main/kotlin")
kotlinOptions {
jvmTarget = "1.8"
}
buildFeatures {
compose = true
}
composeOptions {
kotlinCompilerExtensionVersion = "1.1.1"
}
packagingOptions {
resources {
excludes += "/META-INF/{AL2.0,LGPL2.1}"
}
}
}
Adam Powell
06/01/2022, 2:50 PMbuildSrc
then this can also happen for some non-obvious gradle classpath reasonshenrikhorbovyi
06/01/2022, 2:50 PMandroid
block in build.gradle.kts fileAdam Powell
06/01/2022, 2:52 PMbuildSrc
in this project?henrikhorbovyi
06/01/2022, 2:52 PMAdam Powell
06/01/2022, 2:53 PMhenrikhorbovyi
06/01/2022, 2:53 PMAdam Powell
06/01/2022, 2:54 PMbuildSrc
henrikhorbovyi
06/01/2022, 2:54 PMdependencies {
api("com.android.tools.build:gradle:7.1.2")
implementation("com.android.tools.build:gradle-api:7.1.2")
api("com.android.tools.build:bundletool:1.4.0")
implementation(kotlin("stdlib", "1.6.10"))
implementation(kotlin("stdlib-jdk8")) // enforcing the same kotlin version to avoiding classpath conflicts
implementation(kotlin("stdlib-jdk7")) // enforcing the same kotlin version to avoiding classpath conflicts
implementation(kotlin("reflect"))
implementation("io.reactivex.rxjava2:rxkotlin:2.4.0")
implementation("io.reactivex.rxjava2:rxjava:2.2.20")
implementation("com.squareup.retrofit2:retrofit:2.9.0")
implementation("com.squareup.retrofit2:adapter-rxjava2:2.9.0")
implementation("com.squareup.retrofit2:converter-moshi:2.9.0")
implementation("com.squareup.moshi:moshi:1.13.0")
implementation("com.squareup.moshi:moshi-kotlin:1.13.0")
kapt("com.squareup.moshi:moshi-kotlin-codegen:1.13.0")
testImplementation("junit:junit:4.13.2")
testImplementation("io.kotlintest:kotlintest-assertions:3.4.2")
}
Adam Powell
06/01/2022, 2:55 PMhenrikhorbovyi
06/01/2022, 3:00 PMkotlin gradle plugin
and android gradle plugin
in the build.gradle.kts (from project root)
Now I need to load them inside the buildSrc/build.gradle.kts
, right?Adam Powell
06/01/2022, 3:23 PMbuildSrc
dependencies {
implementation("com.android.tools.build:gradle:$androidGradlePluginVersion")
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinGradlePluginVersion")
then you must load both of them togetherhenrikhorbovyi
06/01/2022, 3:25 PMAdam Powell
06/01/2022, 4:02 PMhenrikhorbovyi
06/01/2022, 4:24 PMAdam Powell
06/01/2022, 4:29 PMColton Idle
06/02/2022, 6:21 AMI will chat with the Documentation folks so we make it clearer in our Compose documentation.😭
henrikhorbovyi
06/02/2022, 6:04 PM