Skip to content

Commit 26ca17a

Browse files
authored
Upgrade to AGP 4.0 (#1789)
1 parent 86fcb00 commit 26ca17a

File tree

11 files changed

+45
-30
lines changed

11 files changed

+45
-30
lines changed

app/src/main/java/com/firebase/uidemo/database/firestore/FirestoreChatActivity.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.firebase.uidemo.database.firestore;
22

3+
import android.annotation.SuppressLint;
34
import android.os.Bundle;
45
import android.util.Log;
56
import android.view.LayoutInflater;
@@ -39,6 +40,7 @@
3940
* For a general intro to the RecyclerView, see <a href="https://developer.android.com/training/material/lists-cards.html">Creating
4041
* Lists</a>.
4142
*/
43+
@SuppressLint("RestrictedApi")
4244
public class FirestoreChatActivity extends AppCompatActivity
4345
implements FirebaseAuth.AuthStateListener {
4446
private static final String TAG = "FirestoreChatActivity";
@@ -104,7 +106,9 @@ public void onDonePressed() {
104106
@Override
105107
public void onStart() {
106108
super.onStart();
107-
if (isSignedIn()) { attachRecyclerViewAdapter(); }
109+
if (isSignedIn()) {
110+
attachRecyclerViewAdapter();
111+
}
108112
FirebaseAuth.getInstance().addAuthStateListener(this);
109113
}
110114

app/src/main/java/com/firebase/uidemo/database/realtime/FirebaseDbPagingActivity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232

3333
public class FirebaseDbPagingActivity extends AppCompatActivity {
3434

35-
private final String TAG = "PagingActivity";
35+
private static final String TAG = "PagingActivity";
3636

3737
@BindView(R.id.paging_recycler)
3838
RecyclerView mRecycler;

app/src/main/java/com/firebase/uidemo/database/realtime/RealtimeDbChatActivity.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.firebase.uidemo.database.realtime;
22

3+
import android.annotation.SuppressLint;
34
import android.os.Bundle;
45
import android.util.Log;
56
import android.view.LayoutInflater;
@@ -39,6 +40,7 @@
3940
* For a general intro to the RecyclerView, see <a href="https://developer.android.com/training/material/lists-cards.html">Creating
4041
* Lists</a>.
4142
*/
43+
@SuppressLint("RestrictedApi")
4244
public class RealtimeDbChatActivity extends AppCompatActivity
4345
implements FirebaseAuth.AuthStateListener {
4446
private static final String TAG = "RealtimeDatabaseDemo";
@@ -47,7 +49,7 @@ public class RealtimeDbChatActivity extends AppCompatActivity
4749
* Get the last 50 chat messages.
4850
*/
4951
@NonNull
50-
protected static final Query sChatQuery =
52+
protected final Query sChatQuery =
5153
FirebaseDatabase.getInstance().getReference().child("chats").limitToLast(50);
5254

5355
@BindView(R.id.messagesList)
@@ -82,7 +84,9 @@ public void onDonePressed() {
8284
@Override
8385
public void onStart() {
8486
super.onStart();
85-
if (isSignedIn()) { attachRecyclerViewAdapter(); }
87+
if (isSignedIn()) {
88+
attachRecyclerViewAdapter();
89+
}
8690
FirebaseAuth.getInstance().addAuthStateListener(this);
8791
}
8892

app/src/main/java/com/firebase/uidemo/util/ConfigurationUtils.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.firebase.uidemo.util;
22

3+
import android.annotation.SuppressLint;
34
import android.content.Context;
45

56
import com.firebase.ui.auth.AuthUI;
@@ -12,6 +13,7 @@
1213

1314
import androidx.annotation.NonNull;
1415

16+
@SuppressLint("RestrictedApi")
1517
public final class ConfigurationUtils {
1618

1719
private ConfigurationUtils() {
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
sdk=28

build.gradle.kts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
@file:Suppress("UnstableApiUsage")
2+
13
import com.android.build.gradle.BaseExtension
24
import com.android.build.gradle.LibraryExtension
35
import com.jfrog.bintray.gradle.BintrayExtension
@@ -24,15 +26,9 @@ buildscript {
2426
}
2527

2628
plugins {
27-
`build-scan` version "2.0.2"
2829
id("com.github.ben-manes.versions") version "0.20.0"
2930
}
3031

31-
buildScan {
32-
termsOfServiceUrl = "https://gradle.com/terms-of-service"
33-
termsOfServiceAgree = "yes"
34-
}
35-
3632
// See https://github.com/gradle/kotlin-dsl/issues/607#issuecomment-375687119
3733
subprojects { parent!!.path.takeIf { it != rootProject.path }?.let { evaluationDependsOn(it) } }
3834

@@ -45,7 +41,10 @@ allprojects {
4541

4642
if ((group as String).isNotEmpty() && name != "lint" && name != "internal") {
4743
configureAndroid()
48-
configureQuality()
44+
45+
if (name != "lintchecks") {
46+
configureQuality()
47+
}
4948

5049
if (Config.submodules.contains(name) || isLibrary) {
5150
setupPublishing()

buildSrc/src/main/kotlin/Config.kt

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,21 @@ object Config {
22
const val version = "6.3.0-SNAPSHOT"
33
val submodules = listOf("auth", "common", "firestore", "database", "storage")
44

5-
private const val kotlinVersion = "1.3.10"
5+
private const val kotlinVersion = "1.3.72"
66

77
object SdkVersions {
8-
const val compile = 28
9-
const val target = 28
8+
const val compile = 29
9+
const val target = 29
1010
const val min = 16
1111
}
1212

1313
object Plugins {
14-
const val android = "com.android.tools.build:gradle:3.5.0"
14+
const val android = "com.android.tools.build:gradle:4.0.0"
1515
const val kotlin = "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
16-
const val google = "com.google.gms:google-services:4.3.1"
16+
const val google = "com.google.gms:google-services:4.3.3"
1717

18-
const val bintray = "com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4"
19-
const val buildInfo = "org.jfrog.buildinfo:build-info-extractor-gradle:4.7.5"
18+
const val bintray = "com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.5"
19+
const val buildInfo = "org.jfrog.buildinfo:build-info-extractor-gradle:4.15.2"
2020
}
2121

2222
object Libs {
@@ -25,7 +25,6 @@ object Config {
2525
}
2626

2727
object Androidx {
28-
const val appCompat = "androidx.appcompat:appcompat:1.1.0"
2928
const val annotations = "androidx.annotation:annotation:1.1.0"
3029
const val customTabs = "androidx.browser:browser:1.0.0"
3130
const val cardView = "androidx.cardview:cardview:1.0.0"
@@ -59,14 +58,10 @@ object Config {
5958
}
6059

6160
object Misc {
62-
private const val retrofitVersion = "2.4.0"
6361
private const val leakCanaryVersion = "1.6.1"
6462
private const val glideVersion = "4.8.0"
6563
private const val butterVersion = "10.1.0"
6664

67-
const val retrofit = "com.squareup.retrofit2:retrofit:$retrofitVersion"
68-
const val retrofitGson = "com.squareup.retrofit2:converter-gson:$retrofitVersion"
69-
7065
const val leakCanary = "com.squareup.leakcanary:leakcanary-android:$leakCanaryVersion"
7166
const val leakCanaryFragments =
7267
"com.squareup.leakcanary:leakcanary-support-fragment:$leakCanaryVersion"
@@ -88,7 +83,7 @@ object Config {
8883
const val junitExt = "androidx.test.ext:junit:1.1.1"
8984
const val truth = "com.google.truth:truth:0.42"
9085
const val mockito = "org.mockito:mockito-android:2.21.0"
91-
const val robolectric = "org.robolectric:robolectric:4.0.2"
86+
const val robolectric = "org.robolectric:robolectric:4.3.1"
9287

9388
const val core = "androidx.test:core:1.2.0"
9489
const val archCoreTesting = "androidx.arch.core:core-testing:2.0.0"

gradle.properties

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
org.gradle.jvmargs=-Xmx4g -Xms4g -Dfile.encoding=UTF-8
22
org.gradle.parallel=true
3-
org.gradle.configureondemand=true
43
org.gradle.caching=true
54

65
android.useAndroidX=true
7-
android.enableJetifier=true
8-
android.enableUnitTestBinaryResources=true
6+
android.enableJetifier=true
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.1-all.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-6.4.1-all.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

proguard-tests/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ android {
2727

2828
variantFilter {
2929
if (inCiBuild && name == "debug") {
30-
setIgnore(true)
30+
ignore = true
3131
}
3232
}
3333
}

settings.gradle

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
// https://docs.gradle.com/enterprise/gradle-plugin/#gradle_6_x_and_later
2+
plugins {
3+
id "com.gradle.enterprise" version "3.3.3"
4+
}
5+
6+
gradleEnterprise {
7+
buildScan {
8+
termsOfServiceUrl = "https://gradle.com/terms-of-service"
9+
termsOfServiceAgree = "yes"
10+
}
11+
}
12+
113
rootProject.buildFileName = 'build.gradle.kts'
214

315
include(
@@ -11,4 +23,4 @@ include(
1123
":lint",
1224

1325
":proguard-tests", ":internal:lint", ":internal:lintchecks"
14-
)
26+
)

0 commit comments

Comments
 (0)