To migrate an Eclipse project to an Android Studio project, you have two options:
- Importing the Eclipse project directly into Studio. This is the preferred approach, and has numerous advantages:
- It will detect many source libraries (such as ActionBarSherlock) and binary libraries (e.g. guava.jar), and will replace these with maven dependencies instead, which means you no longer have to maintain the libraries manually
- It will rewrite the project using the new canonical Android Gradle project structure, which supports instrumentation tests in the same project as the tested code, flavor and build type specific resources, etc
- Exporting the Eclipse project from Eclipse as a Gradle project. This mechanism is not as flexible (or frequently updated) as the direct Gradle import, but it has two usages:
- It will let you keep your Gradle project using the same file structure as Eclipse ADT projects (in other words, it does not move files around; everything is kept in place, and a special build.gradle file tells Gradle to look for sources in the old directory structure rather than the new one). This is useful if you want to continue working with both Studio and Eclipse on the same codebase.
- If your project is doing a lot of Eclipse-specific directory mappings (with path variables, linked resources etc) it's possible that the Android Studio importer can not resolve the paths properly; in that case, try the Eclipse exporter (but please also file a bug so we can fix the importer).
Importing Directly into Android Studio
To import into Android Studio, select File > Import, and then select the directory containing your Eclipse ADT project. A wizard will open and guide you through the rest of the import process. When the project import has finished, it will open up a file called "import-summary.txt" which lists all the steps taken during import and suggestions for next steps. For example, it may note files that were not migrated, it may note missing components in your SDK install, and so on.
Exporting from Eclipse
Open the project in Eclipse, and from there, export the project. NOTE: Make sure you are using the latest possible version of Eclipse since we have fixed issues related to export recently.
Choose the Gradle option:
Proceed through the wizard. When you are done, you can import the build.gradle file into Android Studio.
For more information on customizing your build once you have the basics set up, see the new build system user guide
. For additional information, see the build system overview page