'jetpack compose: @Preview is unresolved after updating to alpha08
I updated compose libraries from alpha07 to alpha08
version = "1.0.0-alpha08"
androidx.compose.ui:ui:$version
androidx.ui:ui-tooling:$version
But after that androidx.ui.tooling.preview.Preview is unresoved
Solution 1:[1]
Checking out the release note of alpha08 in Jetpack compose, you'll notice that ui-tooling has been moved from androidx.ui to androidx.compose.ui
Changes you need to make:
dependencies {
    // New dependencies
    implementation "androidx.compose.ui:ui-tooling:1.0.0-alpha08"
    testImplementation "androidx.compose.ui:ui-test:1.0.0-alpha08"
    // Old dependencies
    implementation "androidx.ui:ui-tooling:1.0.0-alpha07"
    testImplementation "androidx.ui:ui-test:1.0.0-alpha07"
}
Solution 2:[2]
you mean using :
dependencies {
// New dependencies
implementation 'androidx.compose.ui:ui-tooling:1.0.0-beta02"
testImplementation "androidx.compose.ui:ui-test:1.0.0-beta02"
// Old dependencies
implementation "androidx.ui:ui-tooling:1.0.0-alpha07"
testImplementation "androidx.ui:ui-test:1.0.0-alpha07"
}
And using
android {
//....
compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
    jvmTarget = '1.8'
    useIR = true
}
buildFeatures {
    compose true
}
composeOptions {
    kotlinCompilerVersion "1.4.31"
    kotlinCompilerExtensionVersion "1.0.0-beta02"
}
}
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach 
{
kotlinOptions {
    jvmTarget = "1.8"
}
 
but this doesn't fix the problem for me.
Top gradle :
dependencies {
    classpath "com.android.tools.build:gradle:4.2.0-alpha16"
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.31"
 }
i didn't find any solution for now using last compose dependencies versions.
Solution 3:[3]
Solved the problem by :
- Using the latest Android Studio Artic Fox (Canary build) and not any other canary old IDE. 
- Use Android studio Artic Fox Embeded JDK (openjdk version "11.0.8") or download and replace 1.8 java by OpenJdk 11. 
- Update dependencies as above. 
in this case all are good and all compile ,
Voila,
Solution 4:[4]
The latest tooling dependency which worked for me is
 implementation "androidx.compose.ui:ui-tooling:1.2.0-alpha07"
I am using
Android Studio Arctic Fox | 2020.3.1
Build #AI-203.7717.56.2031.7583922, built on July 27, 2021
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source | 
|---|---|
| Solution 1 | |
| Solution 2 | issamux | 
| Solution 3 | issamux | 
| Solution 4 | Aman Srivastava | 
