Updating Old Android Studio Projects to work in Android Studio 3.0+

As a lead consultant, I worked on so many Android applications in the past. In recent days, I have had to revisit some of them to make changes for clients. Back in 2014 when I was spearheading the development of a major education app in Ghana — Mobile School Report Card(mSRC) , I wrote my code entirely in an old version of Android studio. A few days back I pulled my code to run in Android Studio 3.1.3 and it could not sync. I fixed it after making some changes mainly upgrading Gradle. Let me take some time to explain how to go about this. It might save some other developers some time. Lets take this in three (3) simple steps;

Step 1 :

Navigate to the gradle/wrapper directory in your old Android project.

Step 2:

Find the gradle-wrapper.properties file in the gradle/wrapper directory. While in the gradle-wrapper.properties file, find your gradle version at the bottom of the file.

In my old project as seen on the left here, the Gradle version is 2.2.1.

Now I have changed my Gradle version to 4.4

NB: -all distribution as used in both screens allows your IDE code completion and also the ability to navigate to Gradle source code.

Step 3:

Finally, lets change two things and we are good to go — we are changing repositories and dependencies.

Change 1: I changed mavenCentral() under repository to google() and jcenter(). Using jcenter also allows you access to all resources on Maven Central. The google() allows you access to Google allows you access to Google’s maven repository. It only works on Gradle 4+

Classpath for dependencies also changed from gradle:1.3.0 to gradle:3.1.3

Now sync your project and run. You should be good to go.

--

--