Android Studio Arctic Fox Canary 4 (2020.3.1.4) is now available in the Canary and Dev channels.
If you have Android Studio set to receive updates on the Canary or Dev channel, you can get the update by choosing Help > Check for Updates (Android Studio > Check for Updates on macOS). Otherwise, you can download it here.
For information on new features and changes in all preview builds of Android Studio Arctic Fox, see the Android Studio Preview release notes. For details of bugs fixed in each preview release, see previous entries on this blog.
We greatly appreciate your bug reports, which help us to make Android Studio better. If you encounter a problem, let us know by reporting a bug. Note that you can also vote for an existing issue to indicate that you are also affected by it.
StateFlow support in data binding
For Kotlin apps that use coroutines, you can now use
StateFlow
objects as a data binding source to automatically notify the UI about
changes in the data. Your data bindings will be lifecycle aware and
will only be triggered when the UI is visible on the screen.
To use a StateFlow
object with your binding class, you need to specify a
lifecycle owner to define the scope of the StateFlow
object, and in your
layout, assign the properties and methods of your ViewModel
component to
the corresponding views using binding expressions, as shown in the following
snippets:
class ViewModel() { val username: StateFlow}
<TextView android:id="@+id/name" android:text="@{viewmodel.username}" />
If you're in a Kotlin app that uses AndroidX, StateFlow
support is
automatically included in the functionality of data binding, including the
coroutines dependencies.
To learn more, see the user guide.
General Fixes
This update includes fixes for the following issues:
Android Gradle Plugin- Issue #174605126: generateReleaseLintModel fails when lintOptions.checkDependencies = true in AGP 7.0.0-alpha01.
- Issue #173911569: gradle 4.1.0 no longer embedding wear apk in mobile apk.
- Issue #174785779: RepositoryLoader.loadFromResFolder: Control-flow exceptions (like ProcessCanceledException) should never be logged
- Issue #174594763: Android Studio doesn't display strings when using -fsigned-char
- Issue #170967396: caret-position not saved for editor-type-id="android-source-code"
- Issue #174245735: [Compose] Custom formatter
- Issue #175001233: ThreadDetector: better handling of annotations on functional interface methods
- Issue #174686925: Unable to migrate to latest version of the AGP