Android Development: "Gradle Recipes for Android" read notes (translation) 2.3--Export app with Eclipse ADT

Source: Internet
Author: User
Tags build gradle

Problem:

Want to use Gradle in an existing Eclipse ADT project

Solution:

Eclipse ADT Plugin can help generate Gradle files

Discuss:

The ADT plugin for Eclipse was the main Android development tool before the launch of Gradle in 2013. The ADT project is now being replaced by Android studio, but there are still legacy projects.

ADT Plug-ins can be based on existing project structures and dependencies that help you build gradle profiles.

Although this is not a mainstream mechanism, but in practice will encounter such a project. This is also a good opportunity to showcase the sourceset mapping in Gradle, and how to match the old project structure to the new Gradle-based project.

The structure of Eclipse ADT trial teaching all the code in the root directory, preceded by a directory called SRC. The resource is placed under the directory called res in the root directory. The manifest file is also under the root directory. All of these locations have changed under the new project structure.

The Gradle file generated by the ADT plugin shows partial conversions:

You will be interesting to find the map in the Sourcesets block completed. The source files under the new project structure are stored under Src/main/java. An existing project has a SRC directory. So the Sourcesets block uses the Srcdirs property to make a mapping from the Src/main/java to the SRC directory. In fact, the entire folder uses this mechanism to map from the old structure to the new structure.

Android Development: "Gradle Recipes for Android" read notes (translation) 2.3--Export app with Eclipse ADT

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.