1
00:00:05,200 --> 00:00:06,500
Welcome back, everyone.

2
00:00:06,500 --> 00:00:10,100
The first place I like to start when reviewing an existing project

3
00:00:10,350 --> 00:00:13,350
is with the versions of the library that our code uses.

4
00:00:14,350 --> 00:00:17,350
In the Gradle Scripts section of the project pane,

5
00:00:17,710 --> 00:00:20,710
we've got two build.gradle files.

6
00:00:21,510 --> 00:00:23,510
You've seen these in earlier lectures

7
00:00:23,510 --> 00:00:26,310
when we converted the app to androidx, for example.

8
00:00:26,810 --> 00:00:30,010
You'll have created your version of this app much later than me

9
00:00:30,310 --> 00:00:33,310
and will probably have later versions of most things.

10
00:00:33,810 --> 00:00:35,810
But it's worth reviewing these files.

11
00:00:36,410 --> 00:00:39,210
Google is still working on the androidx libraries

12
00:00:39,210 --> 00:00:41,210
and your versions might be out of date.

13
00:00:41,710 --> 00:00:44,710
I'll start with the build.gradle project file.

14
00:00:47,370 --> 00:00:50,370
There are two things in here that change over time.

15
00:00:50,370 --> 00:00:53,070
The first is the version of the Kotlin plugin.

16
00:00:53,430 --> 00:00:58,030
Currently it's at version 1.3.71.

17
00:00:58,530 --> 00:01:02,530
And as you can see, I'm using version 1.3.21.

18
00:01:03,410 --> 00:01:06,110
Android has highlighted the plug-in version

19
00:01:06,110 --> 00:01:09,310
and suggests version 1.3.71.

20
00:01:09,910 --> 00:01:12,110
Type the new version in on line 4.

21
00:01:16,310 --> 00:01:20,410
You can sometimes use the light bulb on line 11 to choose a new version.

22
00:01:20,960 --> 00:01:23,760
But I've had little success getting that option to appear.

23
00:01:24,260 --> 00:01:26,560
Typing the new version is just easier.

24
00:01:27,110 --> 00:01:30,100
The gradle build version on line 10

25
00:01:30,100 --> 00:01:31,700
also updates frequently.

26
00:01:32,300 --> 00:01:35,550
But if you accepted android studio's dialog to update,

27
00:01:35,550 --> 00:01:39,750
it, should now be correct. At the time of recording this video,

28
00:01:39,750 --> 00:01:42,110
the version is 3.6.1.

29
00:01:42,810 --> 00:01:45,170
Click the sync now button,

30
00:01:45,530 --> 00:01:48,530
then open the build gradle module file.

31
00:01:54,030 --> 00:01:56,590
Once again, I've got quite a few suggestions.

32
00:01:57,090 --> 00:01:59,190
You probably won't have as many

33
00:01:59,190 --> 00:02:02,090
because you'll be using newer versions of the libraries.

34
00:02:02,690 --> 00:02:05,050
It's worth reviewing the suggestions though.

35
00:02:05,710 --> 00:02:09,210
When I started this project, the latest version of android

36
00:02:09,210 --> 00:02:10,710
was API 28.

37
00:02:11,070 --> 00:02:14,570
You can see in the compile SDK version

38
00:02:14,570 --> 00:02:16,270
and the target SDK version,

39
00:02:16,930 --> 00:02:18,290
both are set to 28.

40
00:02:19,290 --> 00:02:22,090
Unless you've got a good reason to do otherwise,

41
00:02:22,090 --> 00:02:24,690
set them both to the latest version of android.

42
00:02:31,590 --> 00:02:34,290
If you're watching this later in 2020

43
00:02:34,290 --> 00:02:36,890
and the next version of android has been released,

44
00:02:37,190 --> 00:02:40,190
then use that version rather than version 29.

45
00:02:40,690 --> 00:02:43,290
New versions are normally released around September

46
00:02:43,590 --> 00:02:47,190
but are available in beta from around April or May.

47
00:02:47,490 --> 00:02:50,490
Don't use the beta versions for a live app though.

48
00:02:51,290 --> 00:02:55,290
Next, we have the library versions in the dependencies section.

49
00:02:58,090 --> 00:02:59,690
I've got a few suggestions in there.

50
00:03:00,490 --> 00:03:04,690
The lifecycle extensions are now at version 2.2.0,

51
00:03:05,050 --> 00:03:08,350
not the 2.0.0 that I'm using here,

52
00:03:08,950 --> 00:03:10,150
that's on line 33.

53
00:03:11,150 --> 00:03:15,750
The light bulb works quite well here as long as you click somewhere on the line

54
00:03:15,750 --> 00:03:17,350
before the final colon.

55
00:03:18,250 --> 00:03:22,150
Use a light bulb and choose change to 2.2.0. Or if you prefer,

56
00:03:24,950 --> 00:03:27,550
you can just edit the line.

57
00:03:28,410 --> 00:03:31,730
Next, I'm using an alpha version of appcompat

58
00:03:31,730 --> 00:03:33,030
on line 37.

59
00:03:33,930 --> 00:03:38,730
It's a very bad idea to release an app that's using an alpha or beta version of the library.

60
00:03:39,530 --> 00:03:41,530
This is where we have to be careful.

61
00:03:42,030 --> 00:03:46,290
When I hover over that line, the suggestion is to use version

62
00:03:46,290 --> 00:03:50,490
1.2.0-alpha03.

63
00:03:50,790 --> 00:03:53,790
I'm not going to use that version. It's an alpha version.

64
00:03:54,450 --> 00:03:58,050
If your suggestion is for 1.2.0 without the alpha,

65
00:03:58,050 --> 00:03:59,050
then use that.

66
00:03:59,650 --> 00:04:02,650
I'm going to use version 1.1.0

67
00:04:02,650 --> 00:04:04,650
which is the current stable release.

68
00:04:09,050 --> 00:04:10,350
How do I know that.

69
00:04:10,850 --> 00:04:14,510
The easiest way to check is to copy the library name to your clipboard,

70
00:04:15,060 --> 00:04:19,660
that's androidx.appcompat:appcompat

71
00:04:20,260 --> 00:04:22,620
then, paste it into the Google search engine

72
00:04:25,120 --> 00:04:27,120
and add release history

73
00:04:30,780 --> 00:04:32,780
at the end, then search.

74
00:04:33,380 --> 00:04:36,940
You'll probably get several matches at developer.android.com.

75
00:04:37,440 --> 00:04:39,740
If you get a link to the maven repository,

76
00:04:39,740 --> 00:04:42,140
that should also give you the latest version.

77
00:04:42,800 --> 00:04:44,800
I'm going to use the first result

78
00:04:45,050 --> 00:04:49,050
to get to developer android jetpack androidx

79
00:04:49,050 --> 00:04:50,850
releases appcompat.

80
00:04:52,850 --> 00:04:54,850
In the banner, near the top of the page,

81
00:04:55,050 --> 00:04:59,150
we can see the current version in the current stable release column.

82
00:04:59,650 --> 00:05:01,350
That's the version we want to use.

83
00:05:02,450 --> 00:05:04,050
Back in android studio,

84
00:05:04,050 --> 00:05:07,850
I'll change all my libraries to use the latest stable releases.

85
00:05:08,650 --> 00:05:11,650
The section starts with a to-do about release versions

86
00:05:11,650 --> 00:05:14,010
to help make sure we don't release a version

87
00:05:14,010 --> 00:05:16,510
that contains alpha or beta libraries.

88
00:05:38,010 --> 00:05:40,010
If you get any other suggestions,

89
00:05:40,010 --> 00:05:44,710
change them as well. There may well be later versions available when you're watching this video.

90
00:05:45,590 --> 00:05:49,590
We're done. Remember to click the sync now link

91
00:05:49,590 --> 00:05:53,190
at the top right. If you get an error,

92
00:05:53,690 --> 00:05:54,990
go to the file menu,

93
00:05:56,490 --> 00:05:59,490
choose invalidate caches restart,

94
00:06:00,150 --> 00:06:04,350
choose the option to Invalidate and Restart when the dialog appears.

95
00:06:05,950 --> 00:06:09,450
I like to start with these build files in case there's a problem

96
00:06:09,450 --> 00:06:13,750
when we switch to a different Kotlin version or a different version of one of the libraries.

97
00:06:14,150 --> 00:06:17,750
In the next video, we'll start reviewing the code in our app.

98
00:06:17,750 --> 00:06:19,110
I'll see you there.

