JetBrains / compose-hot-reload

Experimental: Compose Hot Reload
353 stars 12 forks source link

Issue with gradle #2

Closed Aadim1 closed 1 month ago

Aadim1 commented 1 month ago

Hey, I just wanted to start off by saying thank you for creating this experimental feature. I was trying to try them out in my ongoing project, but it failed during gradle setup.

Error Log:

A problem occurred configuring project ':composeApp'.
> Failed to notify project evaluation listener.
   > java.lang.IllegalStateException: Cannot change attributes of configuration ':composeApp:debugAndroidTestCompileClasspath' after it has been locked for mutation
   > KotlinJvmAndroidCompilation with name 'debugAndroidTest' not found.

Setup

settings.gradle.kts

rootProject.name = "<project_name>"
enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")

pluginManagement {
  repositories {
    google {
      mavenContent {
        includeGroupAndSubgroups("androidx")
        includeGroupAndSubgroups("com.android")
        includeGroupAndSubgroups("com.google")
      }
    }
    maven("https://repo.sellmair.io")
    mavenCentral()
    gradlePluginPortal()
  }
}

dependencyResolutionManagement {
  repositories {
    google {
      mavenContent {
        includeGroupAndSubgroups("androidx")
        includeGroupAndSubgroups("com.android")
        includeGroupAndSubgroups("com.google")
      }
    }
    maven("https://repo.sellmair.io")
    mavenCentral()
  }
}

include(":composeApp")
include(":ksp-processor")

// build.gradle.kts(:composeApp)

plugins {
  alias(libs.plugins.kotlinMultiplatform)
  alias(libs.plugins.androidApplication)
  alias(libs.plugins.jetbrainsCompose)
  alias(libs.plugins.compose.compiler)
  id("app.cash.sqldelight") version "2.0.1"
  kotlin("plugin.serialization")
  id("com.android.library") apply false
  id("com.google.devtools.ksp") version "2.0.20-1.0.24"

  // For hot reload
  id("org.jetbrains.compose-hot-reload") version "1.0.0-dev.18"
}

repositories {
  google()
  mavenCentral()
  maven("https://repo.sellmair.io") // can't resolve dependency if I don't add them here.
}

I also tried adding the plugin to project level build.gradle.kts like so, but had the same error.

plugins {
  alias(libs.plugins.androidApplication) apply false
  alias(libs.plugins.androidLibrary) apply false
  alias(libs.plugins.jetbrainsCompose) apply false
  alias(libs.plugins.compose.compiler) apply false
  alias(libs.plugins.kotlinMultiplatform) apply false
  kotlin("plugin.serialization") version "1.9.0" apply false
  alias(libs.plugins.kotlin.android) apply false

  id("com.google.firebase.crashlytics") version "3.0.2" apply false
  id("com.google.gms.google-services") version "4.4.2" apply false

  id("org.jetbrains.compose-hot-reload") version "1.0.0-dev.18" apply false
}

Currently this issue happens when I try to integrate it into my existing application. I will try to add them into a new application and see if the issue persists.

Thank you for your work, and good luck on this project.

Aadim1 commented 1 month ago

Fixed it by bumping the compose version to 1.7.0-beta02