Welcome back, everyone.
The first place I like to start when reviewing an existing project
is with the versions of the library that our code uses.
In the Gradle Scripts section of the project pane,
we've got two build.gradle files.
You've seen these in earlier lectures
when we converted the app to androidx, for example.
You'll have created your version of this app much later than me
and will probably have later versions of most things.
But it's worth reviewing these files.
Google is still working on the androidx libraries
and your versions might be out of date.
I'll start with the build.gradle project file.
There are two things in here that change over time.
The first is the version of the Kotlin plugin.
Currently it's at version 1.3.71.
And as you can see, I'm using version 1.3.21.
Android has highlighted the plug-in version
and suggests version 1.3.71.
Type the new version in on line 4.
You can sometimes use the light bulb on line 11 to choose a new version.
But I've had little success getting that option to appear.
Typing the new version is just easier.
The gradle build version on line 10
also updates frequently.
But if you accepted android studio's dialog to update,
it, should now be correct. At the time of recording this video,
the version is 3.6.1.
Click the sync now button,
then open the build gradle module file.
Once again, I've got quite a few suggestions.
You probably won't have as many
because you'll be using newer versions of the libraries.
It's worth reviewing the suggestions though.
When I started this project, the latest version of android
was API 28.
You can see in the compile SDK version
and the target SDK version,
both are set to 28.
Unless you've got a good reason to do otherwise,
set them both to the latest version of android.
If you're watching this later in 2020
and the next version of android has been released,
then use that version rather than version 29.
New versions are normally released around September
but are available in beta from around April or May.
Don't use the beta versions for a live app though.
Next, we have the library versions in the dependencies section.
I've got a few suggestions in there.
The lifecycle extensions are now at version 2.2.0,
not the 2.0.0 that I'm using here,
that's on line 33.
The light bulb works quite well here as long as you click somewhere on the line
before the final colon.
Use a light bulb and choose change to 2.2.0. Or if you prefer,
you can just edit the line.
Next, I'm using an alpha version of appcompat
on line 37.
It's a very bad idea to release an app that's using an alpha or beta version of the library.
This is where we have to be careful.
When I hover over that line, the suggestion is to use version
1.2.0-alpha03.
I'm not going to use that version. It's an alpha version.
If your suggestion is for 1.2.0 without the alpha,
then use that.
I'm going to use version 1.1.0
which is the current stable release.
How do I know that.
The easiest way to check is to copy the library name to your clipboard,
that's androidx.appcompat:appcompat
then, paste it into the Google search engine
and add release history
at the end, then search.
You'll probably get several matches at developer.android.com.
If you get a link to the maven repository,
that should also give you the latest version.
I'm going to use the first result
to get to developer android jetpack androidx
releases appcompat.
In the banner, near the top of the page,
we can see the current version in the current stable release column.
That's the version we want to use.
Back in android studio,
I'll change all my libraries to use the latest stable releases.
The section starts with a to-do about release versions
to help make sure we don't release a version
that contains alpha or beta libraries.
If you get any other suggestions,
change them as well. There may well be later versions available when you're watching this video.
We're done. Remember to click the sync now link
at the top right. If you get an error,
go to the file menu,
choose invalidate caches restart,
choose the option to Invalidate and Restart when the dialog appears.
I like to start with these build files in case there's a problem
when we switch to a different Kotlin version or a different version of one of the libraries.
In the next video, we'll start reviewing the code in our app.
I'll see you there.