Skip to content

Commit

Permalink
Enable Data Binding using build feature block (google-developer-train…
Browse files Browse the repository at this point in the history
…ing#27)

* Library updates and minsdk

Updated deprecated ViewModelProviders
minsdk to 21
enabled databinding using buildFeatures

* Update build.gradle

* update jdk version.

* Use Proerty syntax

* New options to enable DataBinding using buildFeatures

Android Gradle plugin 4.0.0, to optimize the build performance, introduces a new way to enable build features, such as Data Binding.  This uses the buildFeatures block to enable the features.

Minor Gradle updates
Library updates
Updated minSDK
  • Loading branch information
android-dev-lxl committed Aug 17, 2020
1 parent f08ece8 commit c1b51d4
Show file tree
Hide file tree
Showing 26 changed files with 136 additions and 178 deletions.
19 changes: 8 additions & 11 deletions AndroidTrivia-Starter/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,11 @@ apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'

android {
compileSdkVersion 28
dataBinding {
enabled = true
}
compileSdkVersion 30
defaultConfig {
applicationId 'com.example.android.navigation'
minSdkVersion 19
targetSdkVersion 28
targetSdkVersion 30
vectorDrawables.useSupportLibrary = true
versionCode 1
versionName "1.0"
Expand All @@ -42,17 +39,17 @@ android {
}
productFlavors {
}
buildFeatures {
dataBinding true
}
}

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
implementation "androidx.appcompat:appcompat:$supportlibVersion"
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha1'
implementation 'androidx.legacy:legacy-support-v4:1.0.0-beta01'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.0-alpha4'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha4'
implementation "com.google.android.material:material:1.0.0-rc01"
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-rc1'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation "com.google.android.material:material:1.3.0-alpha02"
}
4 changes: 2 additions & 2 deletions AndroidTrivia-Starter/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ buildscript {
ext {
kotlin_version = '1.3.72'
archLifecycleVersion = '1.1.1'
gradleVersion = '4.0.0'
supportlibVersion = '1.0.0-rc03'
gradleVersion = '4.0.1'
supportlibVersion = '1.2.0'
dataBindingCompilerVersion = gradleVersion // Always need to be the same.
}
repositories {
Expand Down
12 changes: 6 additions & 6 deletions DessertClicker-Starter/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'

android {
compileSdkVersion 28
compileSdkVersion 30
defaultConfig {
applicationId "com.example.android.dessertclicker"
minSdkVersion 19
targetSdkVersion 28
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Expand All @@ -34,14 +34,14 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dataBinding {
enabled = true
buildFeatures {
dataBinding true
}
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha2'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-rc1'
}
2 changes: 1 addition & 1 deletion DessertClicker-Starter/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.0.0'
classpath 'com.android.tools.build:gradle:4.0.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

// NOTE: Do not place your application dependencies here; they belong
Expand Down
14 changes: 7 additions & 7 deletions DevBytes-starter/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ apply plugin: "androidx.navigation.safeargs"
apply plugin: 'kotlin-android-extensions'

android {
compileSdkVersion 28
compileSdkVersion 30
defaultConfig {
applicationId "com.example.android.devbyteviewer"
minSdkVersion 19
targetSdkVersion 28
minSdkVersion 21
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Expand All @@ -38,8 +38,8 @@ android {
}
}

dataBinding {
enabled = true
buildFeatures {
dataBinding true
}

}
Expand All @@ -49,7 +49,7 @@ dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"

// support libraries
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.google.android.material:material:1.0.0'

Expand Down Expand Up @@ -85,7 +85,7 @@ dependencies {

// arch components
// ViewModel and LiveData
def lifecycle_version = "2.2.0-alpha01"
def lifecycle_version = "2.2.0"
implementation "androidx.lifecycle:lifecycle-extensions:$lifecycle_version"

// logging
Expand Down
2 changes: 1 addition & 1 deletion DevBytes-starter/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.0.0'
classpath 'com.android.tools.build:gradle:4.0.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "android.arch.navigation:navigation-safe-args-gradle-plugin:1.0.0"

Expand Down
11 changes: 6 additions & 5 deletions GDGFinder-Starter/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,11 @@ apply plugin: 'kotlin-kapt'
apply plugin: "androidx.navigation.safeargs"

android {
compileSdkVersion 28
dataBinding {
enabled = true
}
compileSdkVersion 30
defaultConfig {
applicationId "com.example.android.gdgfinder"
minSdkVersion 19
targetSdkVersion 28
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Expand All @@ -44,6 +41,10 @@ android {
androidExtensions {
experimental = true
}

buildFeatures {
dataBinding true
}
}

dependencies {
Expand Down
2 changes: 1 addition & 1 deletion GDGFinder-Starter/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.0.0'
classpath 'com.android.tools.build:gradle:4.0.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$version_kotlin"
classpath "android.arch.navigation:navigation-safe-args-gradle-plugin:$version_navigation"
}
Expand Down
12 changes: 6 additions & 6 deletions GuessTheWord-Starter/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ apply plugin: 'kotlin-android-extensions'
apply plugin: "androidx.navigation.safeargs"

android {
compileSdkVersion 28
compileSdkVersion 30
defaultConfig {
applicationId "com.example.android.guesstheword"
minSdkVersion 19
targetSdkVersion 28
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Expand All @@ -37,21 +37,21 @@ android {
}
}

dataBinding {
enabled = true
buildFeatures {
dataBinding true
}
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
testImplementation 'junit:junit:4.12'

// KTX
implementation 'androidx.core:core-ktx:1.0.1'
implementation 'androidx.core:core-ktx:1.3.1'

// Navigation
implementation "android.arch.navigation:navigation-fragment-ktx:1.0.0"
Expand Down
2 changes: 1 addition & 1 deletion GuessTheWord-Starter/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.0.0'
classpath 'com.android.tools.build:gradle:4.0.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "android.arch.navigation:navigation-safe-args-gradle-plugin:1.0.0"

Expand Down
23 changes: 9 additions & 14 deletions RecyclerViewClickHandler-Starter/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ apply plugin: 'kotlin-kapt'
apply plugin: 'androidx.navigation.safeargs'

android {
compileSdkVersion 28
compileSdkVersion 30
defaultConfig {
applicationId "com.example.android.trackmysleepqualityrecyclerview"
minSdkVersion 19
targetSdkVersion 28
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Expand All @@ -39,8 +39,8 @@ android {
}

// Enables data binding.
dataBinding {
enabled = true
buildFeatures {
dataBinding true
}

}
Expand All @@ -51,18 +51,18 @@ dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"

// Support libraries
implementation "androidx.appcompat:appcompat:1.0.0"
implementation "androidx.fragment:fragment:1.0.0"
implementation "androidx.constraintlayout:constraintlayout:2.0.0-alpha2"
implementation "androidx.appcompat:appcompat:1.2.0"
implementation "androidx.fragment:fragment:1.2.5"
implementation "androidx.constraintlayout:constraintlayout:2.0.0-rc1"

// Android KTX
implementation 'androidx.core:core-ktx:1.0.1'
implementation 'androidx.core:core-ktx:1.3.1'

// Room and Lifecycle dependencies
implementation "androidx.room:room-runtime:$room_version"
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
kapt "androidx.room:room-compiler:$room_version"
implementation "androidx.lifecycle:lifecycle-extensions:2.0.0"
implementation "androidx.lifecycle:lifecycle-extensions:2.2.0"

// Coroutines
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutine_version"
Expand All @@ -71,10 +71,5 @@ dependencies {
// Navigation
implementation "android.arch.navigation:navigation-fragment-ktx:$navigationVersion"
implementation "android.arch.navigation:navigation-ui-ktx:$navigationVersion"

// Testing
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.0-alpha4'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha4'
}

8 changes: 4 additions & 4 deletions RecyclerViewClickHandler-Starter/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ buildscript {
ext {
kotlin_version = '1.3.72'
archLifecycleVersion = '1.1.1'
room_version = '2.0.0'
coroutine_version = '1.0.0'
gradleVersion = '4.0.0'
navigationVersion = '1.0.0-alpha07'
room_version = '2.2.0'
coroutine_version = '1.3.7'
gradleVersion = '4.0.1'
navigationVersion = '1.0.0'
dataBindingCompilerVersion = gradleVersion // Always need to be the same.
}

Expand Down
23 changes: 9 additions & 14 deletions RecyclerViewDiffUtilDataBinding-Starter/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ apply plugin: 'kotlin-kapt'
apply plugin: 'androidx.navigation.safeargs'

android {
compileSdkVersion 28
compileSdkVersion 30
defaultConfig {
applicationId "com.example.android.trackmysleepqualityrecyclerview"
minSdkVersion 19
targetSdkVersion 28
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Expand All @@ -39,8 +39,8 @@ android {
}

// Enables data binding.
dataBinding {
enabled = true
buildFeatures {
dataBinding true
}

}
Expand All @@ -51,18 +51,18 @@ dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"

// Support libraries
implementation "androidx.appcompat:appcompat:1.0.0"
implementation "androidx.fragment:fragment:1.0.0"
implementation "androidx.constraintlayout:constraintlayout:2.0.0-alpha2"
implementation "androidx.appcompat:appcompat:1.2.0"
implementation "androidx.fragment:fragment:1.2.5"
implementation "androidx.constraintlayout:constraintlayout:2.0.0-rc1"

// Android KTX
implementation 'androidx.core:core-ktx:1.0.1'
implementation 'androidx.core:core-ktx:1.3.1'

// Room and Lifecycle dependencies
implementation "androidx.room:room-runtime:$room_version"
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
kapt "androidx.room:room-compiler:$room_version"
implementation "androidx.lifecycle:lifecycle-extensions:2.0.0"
implementation "androidx.lifecycle:lifecycle-extensions:2.2.0"

// Coroutines
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutine_version"
Expand All @@ -71,10 +71,5 @@ dependencies {
// Navigation
implementation "android.arch.navigation:navigation-fragment-ktx:$navigationVersion"
implementation "android.arch.navigation:navigation-ui-ktx:$navigationVersion"

// Testing
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.0-alpha4'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha4'
}

8 changes: 4 additions & 4 deletions RecyclerViewDiffUtilDataBinding-Starter/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ buildscript {
ext {
kotlin_version = '1.3.72'
archLifecycleVersion = '1.1.1'
room_version = '2.0.0'
coroutine_version = '1.0.0'
gradleVersion = '4.0.0'
navigationVersion = '1.0.0-alpha07'
room_version = '2.2.0'
coroutine_version = '1.3.7'
gradleVersion = '4.0.1'
navigationVersion = '1.0.0'
dataBindingCompilerVersion = gradleVersion // Always need to be the same.
}

Expand Down
Loading

0 comments on commit c1b51d4

Please sign in to comment.