Kotlin 1.8 で JetpackCompose を使う

Kotlin を 1.7.21 から 1.8.0 に上げます。


[versions]

# kotlin = "1.7.21"
kotlin = "1.8.0"
compose-compiler = "1.4.0-alpha02"

build します。

はい、エラーでました。


e: This version (1.4.0-alpha01) of the Compose Compiler requires Kotlin version 1.7.21
but you appear to be using Kotlin version 1.7.21 which is not known to be compatible.
Please fix your configuration (or `suppressKotlinVersionCompatibilityCheck` but don't say I didn't warn you!).
https://developer.android.com/jetpack/androidx/releases/compose-kotlin#pre-release_kotlin_compatibility

表示されてるリンクに行きます。

はい、Kotlin 1.8 ありません。

👉 Compose to Kotlin Compatibility Map  |  Android Developers hatena-bookmark

さらに、そのページにあるリンク先へ。

ここにありますね。

👉 Compose Compiler Maven Index hatena-bookmark

さらに、このページにあるリンク先の記述を参考に変更します。


# libs.versions.toml

[versions]

# kotlin = "1.7.21"
# compose-compiler = "1.4.0-alpha02" # composeOptions ↔ kotlin 1.7.21

kotlin = "1.8.0"
compose-compiler = "1.4.0-dev-k1.8.0-33c0ad36f83"


// settings.gradle

dependencyResolutionManagement {
  repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
  repositories {
    google()
    mavenCentral()

    maven {
      url "https://androidx.dev/storage/compose-compiler/repository/"
    }


// build.gradle (:app)

composeOptions {
  kotlinCompilerExtensionVersion libs.versions.compose.compiler.get()
}

👉 jimgoog/ComposeAppUsingPrereleaseComposeCompiler: Demonstrates using Compose with pre-releases of KotlinCompiler and ComposeCompiler hatena-bookmark


 

■ まとめ

Kotlin バージョンと Compose Compiler のバージョンは密接に関係しています。

ちなみに、Compose UI 側のバージョンは以前のままの alpha03 (現最新) で、まあまあ良さげです。


[versions]

kotlin = "1.8.0"
compose-compiler = "1.4.0-dev-k1.8.0-33c0ad36f83"
compose-ui = "1.4.0-alpha03"


[libraries]

compose-ui = { module = "androidx.compose.ui:ui", version.ref = "compose-ui" }
compose-ui-tooling = { module = "androidx.compose.ui:ui-tooling", version.ref = "compose-ui" }
compose-ui-tooling-preview = { module = "androidx.compose.ui:ui-tooling-preview", version.ref = "compose-ui" }
compose-ui-test-manifest = { module = "androidx.compose.ui:ui-test-manifest", version.ref = "compose-ui" }
compose-ui-test-junit4 = { module = "androidx.compose.ui:ui-test-junit4", version.ref = "compose-ui" }


【AndroidStudio】プラグイン Rainbow Brackets が括弧だけでなく 変数 まで色が付くようになる【IDEA】

ネストする括弧を分かりやすく色分けしてくれるプラグイン「Rainbow Brackets」。

👉 IntelliJ IDEA プラグイン「Rainbow Brackets」を使う hatena-bookmark

ついに、変数 (variables) まで色分けしてくれるようになっております。

これが、

こうなる。

少しうざい、括弧だけでいい、という方は、詳細設定できます。

👉 Incompatibility with Semantic highlighting · Issue #2563 · izhangzhihao/intellij-rainbow-brackets hatena-bookmark


2023年 = 令和5年 = 平成35年 = 昭和98年 というような 西暦 - 元号 対照表


  ad    reiwa    heisei    showa
----  -------  --------  -------
2023        5      (35)     (98)
2022        4      (34)     (97)
2021        3      (33)     (96)
2020        2      (32)     (95)
2019        1        31     (94)
2018                 30     (93)
2017                 29     (92)
2016                 28     (91)
2015                 27     (90)
2014                 26     (89)
2013                 25     (88)
2012                 24     (87)
2011                 23     (86)
2010                 22     (85)
2009                 21     (84)
2008                 20     (83)
2007                 19     (82)
2006                 18     (81)
2005                 17     (80)
2004                 16     (79)
2003                 15     (78)
2002                 14     (77)
2001                 13     (76)
2000                 12     (75)
1999                 11     (74)
1998                 10     (73)
1997                  9     (72)
1996                  8     (71)
1995                  7     (70)
1994                  6     (69)
1993                  5     (68)
1992                  4     (67)
1991                  3     (66)
1990                  2     (65)
1989                  1       64

👉 【Python】2022年 = 令和4年 = 平成34年 = 昭和97年 というような 西暦 - 元号 対照表 hatena-bookmark