Android Studio 0.4.5 breaks existing builds, here’s the fix
- select the contributor at the end of the page -
Fix part 1When you complete the update to Android Studio 0.4.5 and open one of your existing projects, you'll see this scary message: What in the world is that message telling us? It feels kind of like an “it’s broken” message. We know it's bad but have no information as to what actually happened. Clicking on the “open event log” link to the right of the error message gives us a little more information.
build.gradlefile that’s a peer to the application’s
srcfolder (be sure to open the correct
build.gradlefile, there are multiple in the project hierarchy).
0.5. You might be tempted to change that version to 1.9 since the error message says you need version 1.9 or above, but this would be wrong. The version number ties to the tools package rather than directly to the Gradle version. The proper fix is for us to change the
Fix part 2So with the Gradle version issue resolved, we can try to build our project. And with that comes more good news...and bad news. The good news is that scary “Gradle project sync failed” message is gone. The bad news? Now we have have a build error.
build.gradlefile we worked on previously and locate the line for
19.0.1. By changing the version number, the build system will now use the correct version of the build tools. And now the build works!
Putting it all togetherWe touched on a number of issues as we went through the process of identifying how to fix our project to work with Android Studio 0.4.5, but in reality there are just a few steps to get things fixed up.
- Use the Android SDK Manager to download Android SDK Build Tools Rev. 19.0.1
- Open the
build.gradlefile that’s a peer to the
srcfolder in the project hierarchy
- Change the
com.android.tools.build:gradleentry to use version
- Change the
buildToolsVersionentry to use version
build.gradlefile appears as follows: