iamthevoid
06/04/2021, 9:58 AMPreview
in compose? A have build.gradle.kts
like i’ll post in thread shortly, but i receive error when try to build previewiamthevoid
06/04/2021, 9:59 AMplugins {
id("com.android.library")
kotlin("android")
}
sourceSets.create("main") {
java.srcDirs += java.srcDir("src/main/kotlin")
}
android {
compileSdk = Versions.Android.compileSdk
defaultConfig {
minSdk = Versions.Android.minSdk
}
buildFeatures {
compose = true
}
compileOptions {
sourceCompatibility = Versions.javaVersion
targetCompatibility = Versions.javaVersion
}
kotlinOptions {
jvmTarget = "1.8"
}
composeOptions {
kotlinCompilerExtensionVersion = Versions.Compose.main
}
}
dependencies {
implementation(project(Dependencies.Modules.DesignSystem.shared))
implementation(project(Dependencies.Modules.DesignSystem.pagecontrol))
implementation(project(Dependencies.Modules.DesignSystem.badges))
implementation(Dependencies.Compose.ui)
implementation(Dependencies.Compose.foundation)
implementation(Dependencies.Compose.uiTooling)
implementation(Dependencies.Compose.material)
}
iamthevoid
06/04/2021, 9:59 AMThe following classes could not be instantiated:
- androidx.compose.ui.tooling.preview.ComposeViewAdapter (Open Class, Show Exception, Clear Cache)
Tip: Use View.isInEditMode() in your custom views to skip code or show sample data when shown in the IDE. If this is an unexpected error you can also try to build the project, then manually refresh the layout. Exception Details java.lang.ClassNotFoundException: androidx.lifecycle.runtime.R$id at java.lang.ClassLoader.loadClass(ClassLoader.java:589) at java.lang.ClassLoader.loadClass(ClassLoader.java:522) at androidx.lifecycle.ViewTreeLifecycleOwner.set ... (ViewTreeLifecycleOwner.java:49) at androidx.compose.ui.tooling.preview.ComposeViewAdapter.init(ComposeViewAdapter.kt:607) at androidx.compose.ui.tooling.preview.ComposeViewAdapter.<init>(ComposeViewAdapter.kt:205) at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(NativeConstructorAccessorImpl.java:-2) at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:490) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:959) at android.view.LayoutInflater.inflate(LayoutInflater.java:657) at android.view.LayoutInflater.inflate(LayoutInflater.java:499) Copy stack to clipboard
iamthevoid
06/04/2021, 10:00 AMiamthevoid
06/04/2021, 10:06 AMcom.android.application
and it starts workingiamthevoid
06/04/2021, 10:07 AMColton Idle
06/04/2021, 7:55 PMColton Idle
06/04/2021, 7:56 PM