Android API Levels

You can set API levels for your apps. The idea is that you set a minimum API level that your app runs on, and the version that your app was compiled for (this is the Target SDK Version). You can also set something called the Build Tools version.

To set al these levels, go to File > Project Structure from the menu bars at the top of Android Studio:

The File menu in Android Studio with the Project Structure item highlighted

From the dialog box that appears, Click on Modules, then app in the middle. On the Properties tab, look for the Compile Sdk Version and the Build Tools Version:

The Project Structure dialog box showing compile and build information

Android Studio 3.5 only goes up to API 28, which is fine. But this is Android 9.0 (Pie). Android 10 is out, though, and this is API 29. You need Android Studio 3.3 or higher to test your apps for Android 10. Even then, you may get errors about Gradle sync failures and warnings about outdated dependencies. Furture versions of Android Studio versions will probably have full support for 10. When it does, you'll see it API 29 in the dropdown box.

For both of these dropdown boxes, Compile Sdk Version and Build Tools Version, select the highest ones. Click Apply and OK and you're done.

Now have a look at the build.gradle file in the project files area on the left:

Android Studio project files showing the build.gradle item highlighted

Double click the build.gradle to open it up. You should see something like this:

The build.gradle file in Android Studio

You can actually type in the various API and Build levels here, rather than open up the dialog box. (The dialog box just adds the values here, in this file.) In the image above, you can see that the compileSdkVersion is 28, while the buildToolsversion is 29.0.1. The minimum SDK version is set to 15 while the targetSdkVersion is 28,

Click the Open Project Structure link in the top right to see the dialog box again.

Notice the dependencies area at the bottom. You can add your own here, if you need to.

 

And that's it for this section. Try to adapt the app. Add some content for the webpages. Or change the grid view images and headings to something of your own choosing. You'll probably see lots of apps in the Google Play store that use a GridView and WebView. You can now add your own!

Back to the Android Contents Page