Can Jetpack Compose be used with Kotlin 1.8.0 - android

The release notes for Kotlin 1.8.0 mention Jetpack Compose
https://kotlinlang.org/docs/whatsnew18.html
But the latest version that can be used by Jetpack Compose is 1.7.21
https://developer.android.com/jetpack/androidx/releases/compose-kotlin
What am I missing here?
Update: Literally hours after posting this, Jetpack released 1.4.0 which is compatible with Kotlin 1.8.0.

The Kotlin 1.8.0 release notes mention that Jetpack Compose is now supported by the Kotlin language, but it does not necessarily mean that the current version of Jetpack Compose 1.4.0-alpha02 is compatible with Kotlin 1.8.0.
The version of Jetpack Compose that is listed on the Android developer website (1.7.21) is the latest version that has been tested and is known to work with the specified version of the Kotlin language.
To use the latest version of Kotlin (1.8.0) with Jetpack Compose, you will need to wait for a new version of Jetpack Compose that is compatible with Kotlin 1.8.0 to be released.
Update
Jetpack compose compiler version 1.4.0 is compatible with Kotlin 1.8.0 - release notes : https://developer.android.com/jetpack/androidx/releases/compose-compiler#1.4.0

Related

Flutter Plugin migrating to supports the Android V2 embedding

I work on a Flutter mobile app project and we use flutter_stripe_payment plugin there. But author doesn't support it anymore and we facing the issue when trying to upgrade flutter higher that 2.2.3
The plugin `stripe_payment` uses a deprecated version of the Android embedding.
To avoid unexpected runtime failures, or future build failures, try to see if this plugin supports the Android V2 embedding. Otherwise, consider removing it since a future release of Flutter will remove these deprecated APIs.
If you are plugin author, take a look at the docs for migrating the plugin to the V2 embedding: https://flutter.dev/go/android-plugin-migration.
I forked the library repository and applied migration steps and replaced the link in yaml file to
stripe_payment:
git:
url: https://github.com/ldemyanenko/flutter_stripe_payment
ref: master
But I'm still facing the same issue. I'm not sure what I'm doing wrong. The code and the latest two commits with migration are here
p.s. I tried official flutter stripe live from https://pub.dev/packages/flutter_stripe. But it looks like it's a bad fit for us as there is no way to add a cart to saved payment methods through custom ui there.

Using different versions of Compose and ComposeCompiler

According to Compose to Kotlin Compatibility Map, ComposeCompiler must be compatible with Kotlin version.
Is there this compatibility relation between Compose and ComposeCompiler?
Which one should be newer?
I didn't find any document/reference to describe the relation.
It is highly recommended that you use the plugin version matching the library you are using as that combination has received the most testing.
Also, the compose plugin must match the Kotlin compiler version it was intended for so it is recommended that you use the Kotlin compiler version the plugin was built for.
However the minimum current runtime version supported runtime is 1.0.0. This means you can use newer versions of the compiler with older versions of the library.
Beginning with 1.0.0, the Compose Compiler Plugin will feature detect the runtime and generate the code compatible with the runtime it is given. This allows new plugins to be used with older versions of the library. If a feature or optimization requires support from the library and it is not there, it is disabled.
Also, for binary compatibility, the runtime is required to support code generated from older version of the plugin. This allows older versions of the plugin to work with newer libraries.

Shall I downgrade the installed version of Kotlin plugin in Android Studio?

I am getting a warning as I build an Android Kotlin w/ Jetpack compose app with Android Studio like this:
Runtime JAR files in the classpath should have the same version. These files were found in the classpath:
.../transformed/jetified-kotlin-stdlib-jdk8-1.5.31.jar (version 1.5)
.../transformed/jetified-kotlin-stdlib-jdk7-1.5.31.jar (version 1.5)
.../transformed/jetified-kotlin-stdlib-1.6.10.jar (version 1.6)
.../transformed/jetified-kotlin-stdlib-common-1.6.10.jar (version 1.6)
The Kotlin version I am using with my project is 1.5.31, since It is compatible with Compose compile version 1.0.5.
The Kotlin plugin version installed on Android Studio is 1.6.10
Just for reference I am using Android Studio Bumblebee | 2021.1.1 Patch 1.
Shall I downgrade the plugin Kotlin version on Android Studio from 1.6.10 to 1.5.31?
Or, just ignore the warning? Other solution?
This have nothing to do with the plugin version you have installed. Probably some dependency of yours have kotlin 1.6.10 dependency and that's why you hvae this conflict. Try to find out which one using dependency tree - my recommendation is to use gradle scan, you can read about it here. In gradle scan results you can go through all of your dependencies in a tree, like here. You have to find which library is using newer kotlin and then use older version of that library that's targeting your kotlin version

Getting error when running Jetpack Compose samples

I wanted to run "Owl App" from Jetpack Compose sample apps but i got this error:
This version of the Android Support plugin for IntelliJ IDEA (or Android Studio) cannot open this project, please retry with version 4.2 or newer.
What's it for?
This issue causing due to using of newer version of gradle in the project.
You need to use the latest canary version of Android Studio.

Kotlin and Jack unsupported (Android Studio 2.3.2)

I am getting this error while configuring kotlin plugin with Jack. I an using Android studio 2.3.2 currently.
Error:Kotlin Gradle plugin does not support the deprecated Jack toolchain. Disable Jack or revert to Kotlin Gradle plugin version
1.1.1.
If you are using latest IDE(3.0, preview version) it won't let you use Jack or you are using kotlin version above 1.1.1.
Jack has been deprecated because of the build time performance issue, It was mentioned in one of the session of google IO 2017. You can read this blog
In official documentation of Jack following warning is given:
The Jack toolchain is deprecated, as per this announcement. However, you may continue to use it to enable Java 8 language features until the replacement is available.
If you still want to use it, switch back you Android studio IDE to 2.3, and revert back to kotlin 1.1.1
EDIT
Kotlin by default supports Lambda expressions. If you want to use lambda expression in java with Kotlin also, you have to use Android Studio 3.0.

Categories

Resources