翻译 Migrating to Android Studio

Migrating to Android Studio

If you have been using Eclipse with ADT, be aware that Android Studio is now the official IDE for Android, so you should migrate to Android Studio to receive all the latest IDE updates.

 

To migrate existing Android projects, simply import them using Android Studio:

 

  1. In Android Studio, from the main menu or the Welcome to Android Studiopage, choose File > Import Project.
  2. Select the Eclipse root project directory and click OK.

    Note: The Eclipse root directory must contain the AndroidManifest.xml file. Also, the root directory must contain either the .project and .classpath files from Eclipse or the res/ and src/ directories.

  3. Follow the steps in the import wizard.

Android Studio imports the current dependencies, downloads libraries, and creates an Android Studio project with the imported Eclipse project as the main module. Android Studio also creates the required Gradle build files.

The import process replaces any JAR files and libraries with Gradle dependencies, and replaces source libraries and binary libraries with Maven dependencies, so you no longer need to maintain these files manually.

Note: If there are references to Eclipse workspace library files, comment them out in the project.properties or.classpath files that you imported from the Eclipse project. You can then add these files in the build.gradle file. See Configuring Gradle Builds.

For more help getting started with Android Studio and the IntelliJ user experience, learn more about Android Studio and read FAQ on Migrating to IntelliJ IDEA

 

假如你以前是用Eclipse进行开发,想迁移到Android Studio上。你需要导出你的工程,导出的目的是为了生成Gradle文件。然后将导出的工程导入Android Studio即可。

 

 

  • 从Eclipse导出

 

1、更新你的Eclipcs的ADT插件(ADT的版本必须大于等于22.0)

2、在Eclipse中,选择Flie->Export

3、弹出的对话框中,点击Android并选择Generate Gradle build files

4、选择你要导出的工程后点击Finish

你选择导出的工程依旧在原来的路径下,只是多了一个为Android Studio准备的build.gradle文件

 

 

  • 导入到Android Studio中

 

1、在Android Studio中,关闭你当前的工程。页面会跳到欢迎页面。

2、选择Import Project

3、定位到你想要导入的工程的目录,选择build.gradle文件

4、在弹出来的对话框中,不进行任何更改直接点OK

这时你的工程就被导入到Android Studio中了。

 

注意:即使工程没有生成build.gradle文件,你也可以导入到Android Studio中。Android Studio也可以使用Ant来进行编译工程。然后,为了更好的使用其他的功能(如:build variants),我们强烈建议你使用ADT插件生成一个gradle文件或者在Android Studio中直接写gradle文件。更多的内容,可以戳这:http://tools.android.com/tech-docs/new-build-system/user-guide

原文地址:http://developer.android.com/sdk/installing/migrate.html

你可能感兴趣的:(android studio)