# Getting started with Material Components for Android ### 1. Depend on our library Material Components for Android is available through Google's Maven Repository. To use it: 1. Open the `build.gradle` file for your application. 2. Make sure that the `repositories` section includes Google's Maven Repository `google()`. For example: ```groovy allprojects { repositories { google() jcenter() } } ``` 3. Add the library to the `dependencies` section: ```groovy dependencies { // ... implementation 'com.google.android.material:material:1.1.0-alpha06' // ... } ``` Visit [Google's Maven Repository](http://maven.google.com) or [MVN Repository](https://mvnrepository.com/artifact/com.google.android.material/material) to find the latest version of the library. ##### New Namespace and AndroidX If your app currently depends on the original Design Support Library, you can make use of the [`Refactor to AndroidX…`](https://developer.android.com/jetpack/androidx/migrate) option provided by Android Studio. Doing so will update your app's dependencies and code to use the newly packaged `androidx` and `com.google.android.material` libraries. If you don't want to switch over to the new `androidx` and `com.google.android.material` packages yet, you can use Material Components via the `com.android.support:design:28.0.0` dependency. Note: You should not use the `com.android.support` and `com.google.android.material` dependencies in your app at the same time. ### 2. Compile your app with Android P In order to use Material Components for Android, and the latest versions of the Support Libraries, you will have to update your app's `compileSdkVersion` to `28` and download the Android P Preview using the SDK manager. For more information on Android P and its timeline, take a look at the [Program Overview](https://developer.android.com/preview/overview) page. ### 3. Ensure you are using `AppCompatActivity` Using `AppCompatActivity` will ensure that all the components work correctly. If you are unable to extend from `AppCompatActivity`, update your activities to use `AppCompatDelegate`. This will enable the `AppCompat` versions of components to be inflated among other important things. ### 4. Change your app theme to inherit from a Material Components theme Doing an app-wide migration by changing your app theme to inherit from a Material Components theme is the recommended approach. However, be sure to test thoroughly afterwards, as components in existing layouts may change their looks and behavior. Note: If you **can't** change your theme, you can do one of the following: * Inherit from one of our Material Components **Bridge** themes. See the [**Bridge Themes**](#bridge-themes) section for more details. * Continue to inherit from an AppCompat theme and add some new theme attributes to your theme. See the [**App Compat Themes**](#app-compat-themes) section for more details. #### **Material Components themes** The following is the list of Material Components themes you can use to get the latest component styles and theme-level attributes. * `Theme.MaterialComponents` * `Theme.MaterialComponents.NoActionBar` * `Theme.MaterialComponents.Light` * `Theme.MaterialComponents.Light.NoActionBar` * `Theme.MaterialComponents.Light.DarkActionBar` * `Theme.MaterialComponents.DayNight` * `Theme.MaterialComponents.DayNight.NoActionBar` * `Theme.MaterialComponents.DayNight.DarkActionBar` Update your app theme to inherit from one of these themes, e.g.: ```xml ``` For more information on how to set up theme-level attributes for your app, take a look at our [Theming](theming.md) guide, as well as our [Dark Theme](theming/Dark.md) guide for why it's important to inherit from the `DayNight` theme. Note: Using a Material Components theme enables a custom view inflater which replaces default components with their Material counterparts. Currently, this only replaces `