Wednesday, October 23, 2019

Android Studio 4.0 Canary 1 available


Android Studio 4.0 Canary 1 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.

Support for Jetpack Compose

Jetpack Compose toolkit provides a modern approach to building your app's UI. The toolkit also brings all of Kotlin's benefits, such as helping you to write concise and idiomatic code that's fully interoperable with Java.
For the best experience developing with Jetpack compose, you should use the latest version of Android Studio 4.0. That’s because when you use Android Studio to develop your app with Jetpack Compose, you can benefit from smart editor features, such as New Project templates and the ability to immediately preview your Compose UI.
To learn more and get started, go to the Jetpack Compose overview.

Java 8 Library desugaring in D8 and R8

Android Studio now includes support for using a number of Java 8 language APIs without requiring a minimum API level for your app.
Through a process called desugaring, the DEX compiler, D8, in Android Studio 3.0 and higher already provided substantial support for Java 8 language features (such as lambda expressions, default interface methods, try with resources, and more). In Android Studio 4.0, the desugaring engine has been extended to be able to desugar Java language APIs. This means that you can now include standard language APIs that were available only in recent Android releases (such as java.util.streams) in apps that support older versions of Android.
For more information, see the Android Studio 4.0 Preview release notes.

Smart editor features when editing R8/ProGuard rules

Android Studio now provides smart editor features when you open ProGuard rules files, such as syntax highlighting, code completion, and error checking. The editor also integrates with your Android Studio project to provide full symbol completion for all classes, methods, and fields, and includes quick navigation and refactoring.

Support for Kotlin DSL script files

The Android Gradle plugin now supports Kotlin DSL build script files (*.kts). When used with Android Studio, certain IDE features, such as the Project Structure dialog and build script quick fixes, now also support reading and writing to Kotlin build script files.

Motion Editor

Android Studio now includes a visual design editor for the MotionLayout layout type, making it easier to create and preview animations.
The Motion Editor provides a simple interface for manipulating elements from the MotionLayout library that serves as the foundation for animation in Android apps. In previous releases, creating and altering these elements required manually editing constraints in XML resource files. Now, the Motion Editor can generate this XML for you, with support for start and end states, keyframes, transitions, and timelines.
For basic usage instructions, see the Android Studio 4.0 Preview release notes.

Fragment wizard and new fragment templates

A new Fragment wizard and fragment templates are now available by navigating to File > New > Fragment > Gallery or by clicking Create new destination in the Navigation editor.

Feature-on-feature dependencies

In previous versions of the Android Gradle plugin, all Dynamic Feature modules had a dependency on the app’s base module. When using Android Gradle plugin 4.0.0, you can now include a feature module that depends on another feature module. That is, a :video feature can depend on the :camera feature, which depends on the base module.
See usage instructions in the release notes.

'feature' and 'instantapp' Android Gradle plugins removed

Android Gradle plugin 3.6.0 deprecated the Feature plugin (com.android.feature) and the Instant App plugin (com.android.instantapp) in favor of using the Dynamic Feature plugin (com.android.dynamic-feature) to build and package your instant apps using Android App Bundles.
See the release notes for more information.

Kotlin Android live templates

Android Studio now includes Android live templates for your Kotlin classes. For example, you can now type toast and press the Tab key to quickly insert a Toast. For a full list of available live templates, click File > Settings from the menu bar (or Android Studio > Preferences on macOS) and navigate to Editor > Live Templates.

Known issue for Missing Kotlin Maven repo

If you upgrade an existing project to use Android Studio 4.0, you might see the following error message:
Application build has failed with an error (Could not find org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.60-eap-25)
To resolve this issue, include the following in your project's top-level build.gradle file:
buildscript {
    repositories {
        ...
        maven { url 'https://dl.bintray.com/kotlin/kotlin-eap' }
    }
}

allprojects {
    repositories {
        ...
        maven { url 'https://dl.bintray.com/kotlin/kotlin-eap' }
    }
}

General fixes

This update includes fixes for the following public issues:
Android Studio
  • Issue #142467886: Too many attributes in a single causes the app to crash when access R.styleable
App Model
  • Issue #142320330: Dependencies.pb in App Bundle should not be a length-delimited proto
Data Binding
  • Issue #142288059: MergedManifestManager.getSnapshot(facet).getPackage() returns null unexpectedly
  • Issue #142286949: Bindings are being created for non-data binding layouts
  • Issue #140999936: AGP 3.6-alpha11: error: cannot generate view binders java.lang.StackOverflowError
  • Issue #118943890: DataBinding Turkish language problem
  • Issue #142130560: Arch components github sample does not compile with AGP 3.6.alpha11
  • Issue #141633235: data binding crashes if you have Foo extends LiveData
Gradle
  • Issue #141869049: aaptOptions.noCompress should be case-insensitive for android resources
  • Issue #141536986: Missing native libs after update an external dependency with native libs java.lang.UnsatisfiedLinkError find "libmylib-jni.so"
  • Issue #135135421: (suggestion) Task.outputs.cacheIf should specify a reason
Gradle Sync
Kotlin
Lint
Profilers
Project System
Strings Editor
  • Issue #135209257: Android Studio hangs when loading project when translation editor left open
View Binding
For information on new features and changes in all preview builds of Android Studio 4.0, 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.