score:7
Accepted answer
i finally fixed it by declaring an explicit dependency on androidx.activity:activity-compose (similar to this answer) in both my app module as well as my compose module, which the app module depends on. before, i declared the activity compose dependency only in my compose module, not my app module.
this is what my setup looks like now:
// build.gradle (:app)
android {
...
buildfeatures {
compose true
}
composeoptions {
kotlincompilerextensionversion versions.compose
}
compileoptions {
sourcecompatibility javaversion.version_1_8
targetcompatibility javaversion.version_1_8
}
kotlinoptions {
jvmtarget = '1.8'
}
}
dependencies {
implementation project(':core')
implementation project(':common-ui-compose')
...
implementation libs.androidx.activity.activitycompose
// build.gradle (:common-ui-compose)
android {
...
buildfeatures {
compose true
}
composeoptions {
kotlincompilerextensionversion versions.compose
}
compileoptions {
sourcecompatibility javaversion.version_1_8
targetcompatibility javaversion.version_1_8
}
kotlinoptions {
jvmtarget = '1.8'
}
}
dependencies {
implementation project(':core')
...
implementation libs.androidx.activity.activitycompose
score:0
in a multi-module project with kts:
class mylibraryplugin : plugin<project> {
override fun apply(project: project) {
with(project) {
plugins.all {
dependencies {
implementation("androidx.compose.runtime:runtime:1.0.1")//specify the version
}
}
}
}
}
score:9
you need to add compose runtime dependency.
dependencies {
def compose_version = "1.0.0-beta07"
implementation("androidx.compose.runtime:runtime:$compose_version")
}
Source: stackoverflow.com
Related Query
- The compose compiler plugin you are using (version 1.0.0-alpha13) expects a minimum runtime version of 1.0.0-alpha13
- This version (1.1.1) of the Compose Compiler requires Kotlin version 1.6.10 but you appear to be using Kotlin version 1.5.31
- The project is using an incompatible version (AGP 7.3.0-alpha07) of the Android Gradle plugin
- After fixing "Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8" Android studio emulator still doesn't work
- Warning "Kotlin plugin version is not the same as library version" (but it is!)
- kotlin version that is used for building with gradle (1.1.2-5) differs from the one bundled into the IDE plugin (1.1.2-4)
- New Gradle Sync is not supported due to containing Kotlin modules using an unsupported plugin version
- How can I change the Kotlin compiler version on IntelliJ?
- Kotlin version that is used for building with Gradle (1.5.0) differs from the one bundled into the IDE plugin (1.5.0-release-764)
- When trying jetpack compose it show error: compiler backend and cannot be loaded by the old compiler
- Kotlin compile "ERROR: The Android Gradle plugin supports only Kotlin Gradle plugin version 1.3.0 and higher." but no kotlin_version in build.gradle?
- ERROR: The Android Gradle plugin supports only Kotlin Gradle plugin version 1.3.0 and higher
- What are the differences using spring boot with Kotlin and with Java?
- only classes are allowed on the left hand side of a class literal when using Mockito and kotlin
- Cannot use kotlin-gradle-dsl scripts while using android gradle plugin version 7.0.0-alpha15
- When should you use plus, minus, times functions instead of using the operators in Kotlin?
- Using coroutines to write to a log file without loosing the order the logs are in
- How to move focus from Compose Button to Compose TextField by using the arrow key?
- Kotlin compiler not found using Gradle plugin
- Could not deserialize object. Class does not define a no-argument constructor.If you are using ProGuard, make sure these constructors are not stripped
- What is the best Compose way to build preference screens without using a fragment?
- Are number operations using Kotlin as fast as the equivalent with Java primitives?
- The last elements are not visible in LazyColumn. Jetpack Compose
- How to check if coroutines are using the same context?
- How to apply and configure the Kotlin No Arg compiler plugin in Gradle Kotlin DSL?
- Unable to run any application right from the get go in Android Studio using Kotlin+ Jetpack Compose
- Dagger-Hilt Did you forget to apply the Gradle Plugin? But I applied the plugin
- Conditionally show image from the gallery or drawable resource using Coil and Jetpack Compose
- Gradle forcefully brings you the incorrect version of Kotlin dependencies
- I am trying to set a background image in Android using jetpack compose but the image cant fill the whole page
More Query from same tag
- how to round a number in kotlin
- Kotlin/Native multithreading using coroutines
- How to implement admob banner on multiple activities
- Unchecked cast when casting an object of type Any? into a lambda in kotlin
- Firebase HTTPS callable function context.auth is always null when used with custom token auth
- How To Send Intent Back using ActivityLauncher API?
- How can I know the retained class name or keyword when I use navigation framework in Android Studio?
- Android library written in Kotlin, provide support for Java apps
- API response using Retrofit returns null for certain parameters which aren't null
- Explicit type assignment in Koin singleton
- Secure ways of storing client_id's and client_secret's on android app
- How to animate ripple effect from center position to full diameter
- Error running Android (written in Kotlin) project compiled with Gradle2.0.0-alpha plugin
- How to compile Kotlin to include jar of Java with command line?
- How to solve this Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE
- ConcurrentModificationException during mutableStateListOf reverse
- Android observeable in viewmodel only works once
- How to refactor this Android TakePicture code in Kotlin?
- How to paste clipboard data to text editor in android automatically?
- is there any possible way of build an android app to make call when power button is double pressed?
- Android - How can I make my custom view fill the whole screen?
- How to set information in xml from a model of Data Binding in attributes of a custom view
- Kotlin classes with underscores
- Android Jetpack: Observing ArrayList not working
- Is firebase server timestamp value same all over the world?
- How can I use Kotlin default methods with Spring Data repository interfaces?
- How to pass different types of activities
- Which import do i require to make use of hashrouter in KotlinJS React App
- final or val function parameter or in Kotlin?
- How can I set Kotlin compiler options in my Android Studio project, when I can't use Gradle?