Importing Projects to Android Studio

来源:互联网 发布:listview下拉刷新源码 编辑:程序博客网 时间:2024/05/17 07:22

To import a project to Android Studio:

1.Start Android Studio and close any open Android Studio projects.

2.From the Android Studio menu select File > New > Import Project. .Alternatively, from theWelcome screen, select Import project (Eclipse ADT, Gradle, etc.).

3.Select the Eclipse ADT project folder with the AndroidManifest.xml file and clickOk.    

file:///D:/Users/Administrator/AppData/Local/Android/sdk/docs/images/tools/studio-select-project-forimport.png                     图片

4.Select the destination folder and click Next.  

                      图片  

5.Select the import options and click Finish.

The import process prompts to migrate any library and project dependencies to Android Studio, and add the dependency declarations to thebuild.gradle file. The import process also replaces any well-known source libraries, binary libraries, and JAR files that have known Maven coordinates with Maven dependencies, so you no longer need to maintain these dependencies manually. The import options also allow you to enter your workspace directory and any actual path maps to handle any unresolved relative paths, path variables, and linked resource references.

                         图片

6.Android Studio imports the app and displays the project import summary. Review the summary for details about the project restructuring and the import process.                       图片


After importing the project from Eclipse ADT to the new Android Studio project and modulestructure, each app module folder in Android Studio contains the complete source set for thatmodule, including thesrc/main and src/androidTest directories, resources, buildfile, and Android manifest. Before starting app development, you should resolve any issues shown inthe project import summary to make sure the project re-structuring and import process completedproperly.

Validating imported projects

After completing the import process, use the Android Studio Build andRun menu options to build your project and verify the output. If your projectis not building properly, check the following settings:

    • Use the Android SDK button in Android Studio to launch the SDK Manager and verify the installed versions of SDK tools, build tools, and platform match the settings for your Eclipse ADT project. Android Studio inherits the SDK Manager and JDK settings from your imported Eclipse project.
    • Use the File > Project Structure menu option to verify additional Android Studio settings:
      • Under SDK Location verify Android Studio has access to the correct SDK and JDK locations and versions.
      • Under Project verify the Gradle version, Android Plugin version, and related repositories.
      • Under Modules verify the app and module settings, such as signing configuration and library dependencies.
    • If your project depends on another project, make sure that dependency is defined properly in thebuild.gradle file in the app module folder.

    If there still are unexpected issues when building and running your project in AndroidStudio after you have checked these settings, consider modifying the Eclipse ADT project andre-starting the import process. Importing an Eclipse ADT project to Android Studio creates a newAndroid Studio project and does not impact the existing Eclipse ADT project.

    To get started using Android Studio, review theAndroid Studio features andGradle-based build system to become familiar with the newproject and module structure, flexible build settings, and other advanced Android developmentcapabilities. For a comparison of Eclipse ADT and Android Studio features and usage, seeTransitioning to Android Studio fromEclipse. For specific Android Studio how-to documentation, see the pages in theWorkflow section. 



1 0