This version (1.2.0-alpha08) of the Compose Compiler requires Kotlin version 1.6.20 but you appear to be using Kotlin version 1.6.21 which is not known to be compatible.

こんなの出ましたけどー。


> Run with --scan to get full insights.


> Task :app:compileDebugKotlin FAILED
e: This version (1.2.0-alpha08) of the Compose Compiler requires Kotlin version 1.6.20 but you appear to be using Kotlin version 1.6.21 which is not known to be compatible.  Please fix your configuration (or `suppressKotlinVersionCompatibilityCheck` but don't say I didn't warn you!).

言われるがままに、kotlin のバージョンを、1.6.20 に下げればこのエラーは消えてビルド通りますが、

Kotlin 安定版の 1.6.21 を 1.6.20 を下げる

ってのどうなのと。

 

Compose コンパイラ と Kotlin の互換性


Compose Compiler	Compatible Kotlin
1.2.0-alpha08		1.6.20
1.2.0-alpha07		1.6.10
1.2.0-alpha06		1.6.10

以下から、英語版 (言語を「English」に切り替える) にすると分かりやすいです。

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

Kotlin stable 1.6.21 に対応する Compose Compiler は 今現在は pre-release 版しかありません。


 

何でこんなことになるのか?


通常、安定版とアルファ版の両方が同じ日に修正された状態でリリースされると思われます。しかし、AndroidXのモノレポとその関連インフラは、実はこれを阻んでいます。リリースブランチが一つしかないので、Accompanist のような通常のプロジェクトとは異なり、別々に行うことを余儀なくされるのです。


Kotlin 1.6.20のアーティファクトがリリースされてから1週間。ComposeをアップデートするCLはリリース前にできていた。しかし、AndroidXのモノレポでは、無関係な50のライブラリを同時にアップデートすることを強制されるため、未だに不完全です。健全なプロジェクトであれば、同じ日にリリースするはずです。

Drop "androidx" from Jetpack Compose package name, for multiplatform, before 1​.​0 release.
👉 キャンペーン · Drop "androidx" from Jetpack Compose package name, for multiplatform, before 1​.​0 release. · Change.org hatena-bookmark

Compose コンパイラを開発する環境にいろいろ問題とかあるんですかね。

👉 公式 android デベロッパー の英語ページに日本語ページが遅れてる件 hatena-bookmark

 

2022-05-21 追記

1.6.21 対応の beta版がリリースされています。

compose の父が!


これも「English」ページのみ確認できます。注意です!
kotlinCompilerExtensionVersion = "1.2.0-beta02"

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



Android Studio : Never use wildcard imports

Remove wildcard import!!


[Preferences]

  ↓

[Editor]

  ↓

[Code Style]

  ↓

[Kotlin]

  ↓

[Imports]

  ↓

[Top-Level Symbols]/[Java Statics and Enum members]

  ↓

[Use single name import]

IntelliJ: Never use wildcard imports

Input text 'single name' into search area on Preferences screen 🙆

👉 Android Studio : ワイルドカードなインポートをしない設定 hatena-bookmark


Gradle タスクリストが見えない件【Android Studio】

見えなくなりましたね、

これ Task のリスト。

gradle task list

その理由。

Gradle task list is large and slow to populate in Android projects. This feature by default is disabled for performance reasons. You can re-enable it in: Settings | Experimental | Do not build Gradle task list during Gradle sync.

Androidプロジェクトでは、Gradleのタスクリストが大きく、作成に時間がかかります。パフォーマンス上の理由から、この機能はデフォルトで無効になっています。以下で再有効化することができます。


Preferences

↓

Experimental

↓

Do not build Gradle task list during Gradle sync.

Do not build Gradle task list during Gradle sync

👉 Missing [app | android | Tasks | androidDependencies] in the gradel panel [185420705] - Visible to Public - Issue Tracker hatena-bookmark
👉 Gradle tasks are not showing in the gradle tool window in Android Studio 4.2 - Stack Overflow hatena-bookmark

使わないほうがいいんでしょうね。

将来的になくなる機能なのでしょう。

 

タスク一覧表示する

コマンドランチャー的なものが表示されるようになってるのですが、困るのは、オプション部分をはっきり覚えてないので入力ができないことです。

「tasks」 と入力するのが良さげです。

gradle tasks

クリックして選択はできませんが、タスクオプションの一覧は表示されるので、それを見たりコピーして入力できるようになります。


Android tasks
-------------
androidDependencies - Displays the Android dependencies of the project.
signingReport - Displays the signing info for the base and test modules
sourceSets - Prints out all the source sets defined in this project.

Build tasks
-----------
assemble - Assemble main outputs for all the variants.
assembleAndroidTest - Assembles all the Test applications.
build - Assembles and tests this project.
buildDependents - Assembles and tests this project and all projects that depend on it.
buildKotlinToolingMetadata - Build metadata json file containing information about the used Kotlin tooling
buildNeeded - Assembles and tests this project and all projects it depends on.
bundle - Assemble bundles for all the variants.
clean - Deletes the build directory.
compileDebugAndroidTestSources
compileDebugSources
compileDebugUnitTestSources
compileReleaseSources
compileReleaseUnitTestSources

Build Setup tasks
-----------------
init - Initializes a new Gradle build.
wrapper - Generates Gradle wrapper files.

Firebase Crashlytics tasks
--------------------------
injectCrashlyticsMappingFileIdDebug - Injects a mapping file id into the app, used by Crashlytics for deobfuscation.
injectCrashlyticsMappingFileIdRelease - Injects a mapping file id into the app, used by Crashlytics for deobfuscation.
uploadCrashlyticsMappingFileDebug - Uploads mapping files to Crashlytics for crash deobfuscation.
uploadCrashlyticsMappingFileRelease - Uploads mapping files to Crashlytics for crash deobfuscation.

Help tasks
----------
buildEnvironment - Displays all buildscript dependencies declared in root project 'Sample'.
dependencies - Displays all dependencies declared in root project 'Sample'.
dependencyInsight - Displays the insight into a specific dependency in root project 'Sample'.
help - Displays a help message.
javaToolchains - Displays the detected java toolchains.
outgoingVariants - Displays the outgoing variants of root project 'Sample'.
projects - Displays the sub-projects of root project 'Sample'.
properties - Displays the properties of root project 'Sample'.
tasks - Displays the tasks runnable from root project 'Sample' (some of the displayed tasks may belong to subprojects).

Install tasks
-------------
installDebug - Installs the Debug build.
installDebugAndroidTest - Installs the android (on device) tests for the Debug build.
uninstallAll - Uninstall all applications.
uninstallDebug - Uninstalls the Debug build.
uninstallDebugAndroidTest - Uninstalls the android (on device) tests for the Debug build.
uninstallRelease - Uninstalls the Release build.

Verification tasks
------------------
check - Runs all checks.
checkJetifier - Checks whether Jetifier is needed for the current project
connectedAndroidTest - Installs and runs instrumentation tests for all flavors on connected devices.
connectedCheck - Runs all device checks on currently connected devices.
connectedDebugAndroidTest - Installs and runs the tests for debug on connected devices.
deviceAndroidTest - Installs and runs instrumentation tests using all Device Providers.
deviceCheck - Runs all device checks using Device Providers and Test Servers.
lint - Runs lint on the default variant.
lintAnalyzeDebug - Run lint analysis on the debug variant
lintAnalyzeRelease - Run lint analysis on the release variant
lintDebug - Print text output from the corresponding lint report task
lintFix - Runs lint on the default variant and applies any safe suggestions to the source code.
lintFixDebug - Fix lint on the debug variant
lintFixRelease - Fix lint on the release variant
lintRelease - Print text output from the corresponding lint report task
lintReportDebug - Run lint on the debug variant
lintReportRelease - Run lint on the release variant
test - Run unit tests for all variants.
testDebugUnitTest - Run unit tests for the debug build.
testReleaseUnitTest - Run unit tests for the release build.