Opening Pre-Android Studio 3 Projects
The Android Operating System (OS) is constantly evolving due to bug fixes, security updates, new Android versions and features, and support for new hardware. This means updates to the Android Software Development Kit (SDK) and the Android Studio Integrated Development Environment (IDE) happen often.
Each release or update to Android Studio brings changes that can affect existing projects. These changes can affect the build tools, Gradle based build system configuration, the Studio IDE, and the installed libraries. This can impact previous projects. This may mean that a project that opened, built and ran in a previous version of Studio now shows error messages and may fail to build in a newer version of Studio. This article gives some help in fixing issues that occur when opening previous Android projects in a new version of Android Studio.
Checking the Studio Status Bar
Tip: When Android Studio is performing an action on a project the bottom status bar will show messages. This is useful to see if an action is being performed and you need to wait for it to finish before continuing.
Gradle Sync Message
When opening a project after a Studio update, Studio may display the message: Gradle settings for this project are not configured yet.
Click OK for Studio to automatically perform the Gradle configuration.
Removing buildToolsVersion from build.gradle
The Studio Gradle build tools now default to a specific version. Therefore, the build.gradle for the app does not need the buildToolsVersion line. A message will displayed to indicate this:
To fix this message delete the buildToolsVersion line from the app's build.gradle file. The project can then be synced with the updated build.gradle. Use the Sync Project with Gradle Files option under Android from the Tools menu.
Viewing Installed Build Tools Versions
To see the build tools installed use the SDK Manager, opened via the toolbar icon.
Use the SDK Tools tab and the Show Package Details check box to see the Build Tools versions installed.
This is reflected in the build-tools directory under the Android SDK install location.
SDK Version Numbers
Opening projects in newer versions of Studio may require updates to the minSdkVersion and targetSdkVersion settings if libraries drop support for older versions of Android. For example at the time of writing Admob for Android only supports Android API 14 (Ice Cream Sandwich) and later. This means minSdkVersion would need setting to 14. Likewise to support new Android Oreo (API 26) features the targetSdkVersion is set to at least 26. The minSdkVersion and targetSdkVersion are changed in the app's build.gradle file. Again use the Sync Project with Gradle Files option under Android from the Tools menu when the SDK version values are changed.
- See some Android Studio example projects to learn Android app programming.
- For a full list of the articles on Tek Eye see the full site Index
Author:Daniel S. Fowler Published: