To use Jetpack Compose, we first have to use the latest Canary (less stable) version of Android Studio, this is because these canary versions/Channel contain the latest updates of android studio and they are tested by developers who want to be at the forefront of features and tools being dished out by Android.
How can I get the Canary Version?
2 ways, firstly you can simply update your current version of Android studio from (probably the stable channel) to the canary (if you are using the canary channel, simply update by click Help -> Check for Updates -> Update Now on the toolbar)
To update from Stable to Canary channel simply click on Help -> Check for Updates on the toolbar, when the check is completed, there is a highlighted text that says “Configure automatic updates”, click on that. On the next dialog that appears, click the dropdown and select Canary channel, click okay and check for updates again.
Now you should be presented with updates from the Canary Channel.
Secondly (Recommended) Install Stable and Canary Versions side by side.
If you know your way around, simply click here to go the android developer preview website and download the latest canary version of Android Studio (NOT the Release Candidate)
After which you can follow this guide to install Android Studio Canary Build alongside your stable Build
After setup and installations are complete, run your Canary version of Android studio. at the start:
- If you’re in the Welcome to Android Studio window, click Start a new Android Studio project. If you already have an Android Studio project open, select File > New > New Project from the menu bar.
- In the Select, a Project Template window, select Empty Compose Activity and click Next.
- In the Configure your project window, do the following:
- Set the Name to First Jetpack Compose App.
- Note that, in the Language dropdown menu, Kotlin is the only available option because Jetpack Compose works only with classes written in Kotlin.
- In the Minimum API level dropdown menu, select API level 21 or higher.
- Click Finish.
Allow project to build successfully, then head over to your app-level build.Gradle file and add these dependencies to the dependency block if they are not already there
implementation 'androidx.ui:ui-layout:0.1.0-dev03' implementation 'androidx.ui:ui-material:0.1.0-dev03' implementation 'androidx.ui:ui-tooling:0.1.0-dev03' implementation 'androidx.ui:ui-foundation:0.1.0-dev03'
Sync successfully and we are ready to roll, In the next section we would talk about building and running your first basic Jetpack Compose App
456total visits,3visits today