Contrary to popular beliefs, migrating an Android project from Eclipse to Android Studio is the easiest thing there is. After you finish reading this article, you will feel the same way.

For this tutorial, we’ll use a sample Hello World project containing a layout with a TextView and an Activity setting the content view to that layout.

Initial project structure

The starting structure here is the typical Eclipse project for Android.

A typical Eclipse project for Android

Creating Gradle files

We’ll start by creating the settings.gradle and build.gradle files. One build.gradle and one settings.gradle in the root folder (i.e. helloworld folder) of the project, and one build.gradle in the app module itself (i.e. helloworld-example folder).

You can merge the app module and the root folder of the project but this tutorial will not cover that

settings.gradle

The name of the app module folder

include ':helloworld-example'

build.gradle (for the whole project)

// Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript {

repositories {

mavenCentral()

}

dependencies {

classpath 'com.android.tools.build:gradle:0.12.+'

}

} allprojects {

repositories {

mavenCentral()

}

}

build.gradle (for the app module)

Replace “your.packagename” with the package name of your app.

apply plugin: 'com.android.application' android {

compileSdkVersion 19

buildToolsVersion '19.1.0'



defaultConfig {

applicationId "your.packagename"

minSdkVersion 18

targetSdkVersion 19

versionCode 1

versionName "1.0"

}



// signing configs go here



buildTypes {

release {

runProguard false

proguardFiles getDefaultProguardFile('proguard-android.txt'), file('proguard.txt')

}

} sourceSets {

main {

java.srcDirs = ['src']

res.srcDirs = ['res']

manifest.srcFile 'AndroidManifest.xml'

}

}

} dependencies {

compile 'com.android.support:support-v4:19.1.0'

}

Final project structure

The only three files you need

And of course, a video to prove this works!