Android official development documentation from Eclipse to Android studio development

Source: Internet
Author: User
Tags version control system android sdk manager

Android official development documentation from Eclipse to Android Studio development article 1, preface

Migrating projects from Eclipse to Android studio requires adapting to a new project structure, building the capabilities of the system and the IDE. To simplify the migration process, Android Studio provides important tools that enable you to quickly move existing code to files and tools in the Android Studio project infrastructure.

2, Android Studio Foundation (Android studio Basics)

When you migrate your Eclipse project to Android Studio, you should be here to know some of the key differences.

(1) Projects and modules organization (Project and module organization)

Android Studio is an IDE based on IntelliJ idea. Familiarize yourself with the basics of the IDE, such as navigation, code completion, and keyboard shortcuts, see the Android official development documentation for Android Studio (Meet Android Studio).

Android Studio does not use workspaces, so separate projects open windows in different Android studio. Android Studio organizes code into projects that contain everything, defining your Android app from the application source code to build configuration and test code. Each project contains one or more modules that allow you to divide the project into discrete functional units. Modules can be completed independently, tested and debugged.

For more information about the Android studio projects and modules, see Projects Overview.

(2) Build systems based on Gradle (gradle-based build system)

Android Studio's build system is based on Gradle and uses a configuration build file that is written by using the easy-to-extend and custom groovy syntax.

For more information on using and configuring the Gradle tool, see Configure Your build.

(3) Dependent library (Dependencies)

The use of Android Studio tool relies on claims and MAVEN relies on local well-known source code and binary library maven libraries.

(4) Test code

The Eclipse ADT, the test is written in a separate project, is integrated through the element tags in your manifest file. Android Studio provides a androidtest/directory in the main sourceset of your project, so you can easily add and maintain your test code in the same project view. Android Studio also provides tests/catalogs in your project's main sourceset local JVM tests.

3. Prerequisites for Migration (migration prerequisites)

Before migrating your application to Android Studio, check the following steps to make sure your project is ready for conversion and verify that you have the tool configuration you need in Android Studio:

(1) in Eclipse ADT:
    • Ensure that the root directory of Eclipse ADT contains the Androidmanifest.xml file. Additionally, the root directory must contain both the project and the. classpath files from the eclipse or res/and src/directories.
    • Build your project to ensure your new workspace and project updates are saved and included in the import.
    • Or.classpath project.properties comments in the library file of the Eclipse ADT workspace. You can add these references after the Build.gradle file is imported.
    • It may record your workspace directory, path variables, and any actual path graphs that can be used to specify any unresolved relative paths, path variables, and linked resource references. Android Studio allows you to manually specify any unresolved paths during the import process.
(2) in Android Studio:
    • If you haven't downloaded Android studio, first go ahead and download Android studio. If you have already downloaded Android Studio installed, you can click Help > Check for Updates (on MAC, Android Studio > Check for Updates). To verify that the current version is not up to date The stable release version.
    • Because Android Studio does not migrate any third-party Eclipse ADT Plug-ins, it allows you to use any third-party plug-in in eclipse as an annotation. You can search for equivalent feature-compatible plugins in Android studio or in the IntelliJ Android Studio plugin Library. Use the File > Settings > Plugins menu options to manage plugins for your Android studio.
    • If you plan to run Android studio behind the firewall, be sure to set up the proxy server settings and SDK Manager for Android Studio. Android Studio requires the Installation Wizard to synchronize the Internet, access to third-party libraries, access to remote repositories, Gradle initialization and synchronization, and Android studio version updates.
3. Import the project into Android studio

You should decide how to import an existing Eclipse ADT project into Android studio based on its structure:

    • If you have multiple related projects that share the same workspace in Eclipse ADT, import the first project as project, and then add subsequent related projects as modules in the project.
    • If your Eclipse ADT Project shares dependencies in the same workspace instead of other relationships, enter each item separately into the Android Eclipse ADT Studio as a separate project. Android Studio shares dependencies as part of a newly created project.
(1) As a project import
    • Open Android Studio and close other open Android studio projects.
    • From the Android Studio menu, click File > New > Import Project.
      Or, from the Welcome screen, click Import Project (Eclipse ADT, Gradle, etc).
    • Select the Androidmanifest.xml file of the project folder for Eclipse ADT and click OK.

    • Select the destination folder, and then click Next.

    • Select the Import option and click Finish.
    • During the import process, you are prompted to migrate any libraries and projects that rely on Android Studio, and add dependent claims to the Build.gradle file. The import process also replaces any well-known source library's binary libraries, with Maven dependencies already known to the MAVEN coordinates of the jar file, so you no longer need to manually add dependencies. The import option allows you to enter the workspace path and any actual paths that are mapped to handle any unresolved relative paths, path variables, and linked resource references.

    • Android Studio imports the application and displays the project import summary. Summarizes the details of the review project structure adjustment and import process.

After importing a project from Eclipse ADT to Android Studio, the module folder for each app in Android Studio contains the complete source code set for that module, including the Src/main and src/androidtest/directories, resource files, Build the file and application manifest file. Before the app starts developing, you should resolve any issues that appear in the project import summary to ensure that the project rebuild and import process is completed correctly.

(2) Import as module
    • Turn on Android Studio and open the project you need to add modules to.
    • From the Android Studio menu, click File > New > Import Module.
    • Select the Androidmanifest.xml file in the Eclipse ADT project file and click OK.
    • You can modify the name of the module if necessary, and click Next.
    • During the import process, you are prompted to migrate any libraries and projects that rely on Android Studio, and add dependent claims to the Build.gradle file. The import process also replaces any well-known source library's binary libraries, with Maven dependencies already known to the MAVEN coordinates of the jar file, so you no longer need to manually add dependencies. The import option allows you to enter the workspace path and any actual paths that are mapped to handle any unresolved relative paths, path variables, and linked resource references.
    • Click Done.
(3) Validation of imported items

After you complete the import process, build and run menu actions using Android Studio to build your project and output. If your project is not correct, please check the following settings:

    • Verify that the installation version of the tool is set up with the Eclipse project by opening the SDK Manager (click the Android SDK Manager button in Android Studio or click Tools > Android > SDK Manager ).
    • To verify other Android studio settings, click File > Project Structure and check the following:
      The Android SDK location verifies that the project has the correct access to the SDK,NDK, and the location and version of the JDK.
      Under the project, verify the version of the tool, the plugin version of Android, and the associated library file.
      Validating application and module settings, such as signature configuration and library dependencies, under a module
    • If your project is dependent on other engineering projects, make sure that it is correctly defined in the Build.gradle of the Application module's folder.

Consider modifying and restarting the project import process for Eclipse ADT when you have an unexpected problem building and running the Android Studio project Project after you review these settings.

Note: Importing Eclipse ADT projects, Android Studio creates a new Android studio project and does not affect existing eclipse ADT projects.

4, the following steps (Next Steps)

Depending on your project and workflow, you may want to read more about using versioning, managing dependencies, signing and packaging your application, or configuring and updating Android Studio.

(1) Configuring version control

Android Studio supports a variety of version control systems, including Git,github,cvs,subversion,mercurial, and the Google Cloud Source library.

After you import the application to Android studio, use the Android Studio VCs menu action to launch the supported version control system to create a repository, import new files into the repository, and perform other versioning operations:

    • From the Android Studio versioning menu, click Enableversion control integration.
    • Select a version control system associated with the project root from the drop-down menu, and then click OK. The VCs menu now shows some of the system versioning options that are based on your choice.
      Note: You can also use the file > Settings > Version Control menu option to set and modify versioning settings.
(2) Android support Library and Google Play service library

When Eclipse ADT uses the Android support library and Google Services library, Android studio maintains compatible features and supports new features in the Import Android support library and Google Android Library. Android Studio adds these dependent maven dependencies using a known Maven library, so these dependencies do not need to be manually updated.

In eclipse, in order to use the support library, you must modify the Classpath dependency of your project in the development environment of each supporting library that you want to use. In Android Studio, you no longer need to copy the library source into your own project, you can simply declare a dependency and automatically download and merge the library into your project. This includes automating the merging of resources, manifest entries, confusing packaging rules, and customizing lint rules at build time.

(3) App signature

If your application uses a certificate that debugs Eclipse ADT, Android Studio can continue to use the certificate. However, the Debug configuration uses the Debug keystore of Android Studio itself to generate a known password and a known password that is located in the Home/android/debug.keystore default key. When you run or debug your project in Android Studio, the debug build type automatically uses this debug configuration.

When you build your release version of the application, Android Studio will use the release version of the certificate from Eclipse ADT. If you do not publish a version certificate when you import the project, configure the signature information for the release version under the Build.gradle file or use the build > Generate signed apk menu action to open the Generate signature apk.

(4) Adjust the maximum heap value for Android studio

Android Studio has a maximum heap size of 1280MB by default. If you are using a large project, or if your system has a lot of memory, you can improve performance by increasing the maximum heap size in the virtual machine option in Android Studio.

(5) Software update

Android Studio is updated separately from the Gradle plugin, build tool and SDK tool. You can specify which version you want to use with Android Studio.

By default, when a new stable version is released, Android provides Automatic updates, but you can choose to update more frequently, or you can accept updates for previews or beta versions.

If there is translation is not the place also want to correct!

?

I hope your donation will help the translation team to constantly work on translating more content.

Android official development documentation from Eclipse to Android studio development

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.