From 1a1d5db5f6bb7c4f54b8f5513a815ff52f5b0aba Mon Sep 17 00:00:00 2001
From: sreevanis
To use data binding, Android Plugin for Gradle 1.3.0-beta4 +
To use data binding, Android Plugin for Gradle 1.5.0-alpha1 or higher is required.
To get started with Data Binding, download the library from the Support repository in the Android SDK manager.
-The Data Binding plugin requires Android Plugin for Gradle 1.3.0-beta4
-or higher, so update your build dependencies (in the top-level
-build.gradle file) as needed.
+To configure your app to use data binding, add the dataBinding element to your
+top-level build.gradle file with the following configuration:
+android {
+ ....
+ dataBinding {
+ enabled = true
+ }
+}
+
Also, make sure you are using a compatible version of Android Studio. Android Studio 1.3 adds the code-completion and layout-preview support for data binding.
-- Setting Up Work Environment: -
- -
- To set up your application to use data binding, add data binding to the class
- path of your top-level build.gradle file, right below "android".
-
- dependencies {
- classpath "com.android.tools.build:gradle:1.3.0-beta4"
- classpath "com.android.databinding:dataBinder:1.0-rc1"
- }
-
-
- Then make sure jcenter is in the repositories list for your projects in the top-level
- build.gradle file.
-
-allprojects {
- repositories {
- jcenter()
- }
-}
-
-- In each module you want to use data binding, apply the plugin right after - android plugin -
- --apply plugin: 'com.android.application' -apply plugin: 'com.android.databinding' --
- The data binding plugin is going to add necessary provided - and compile configuration dependencies to your project. -
-