The things about Android Studio and Gradle

Source: Internet
Author: User

before getting to the point, first pull a homely, this week into a very nice team, appreciate our leader Tutorchen, make the project development interesting, willing to share, and patience to lead the progress of the team, other partners are also very good, seriously to everyone learning, Together on the attack. here by the way readers recommend a project team collaboration and management of communication tools: The color team to do the Tower,tower home page has a learning video, three minutes you can master its function and use, I believe you will be like me, Love Tower. Well, the words go forward.       

Background Introduction

        using Eclipse to develop Android projects has a lot of chicken ribs, such as super slow startup speed. The Gospel of the Android ERs comes after the Google/io Congress launches Android studio. android Studio is a brand new based on IntelliJ Idea 's Android development environment, similar to the Eclipse ADT plugin, Android Studio provides integrated Android development tools for development and debugging.

typically the introduction to Android Studio is: In addition to the IntelliJ feature, Android Studio also offers: build support based on Gradle, Android-specific refactoring and quick fix, prompt tool for better version capture of program performance, usability, version compatibility and its problems, support for Proguard and app signing features, and a layout editor that lets you drag and drop UI components and preview the layout on multiple configurations, and so on. Some people may not understand what is based on Gradle build support , in the early days of the development of Android do not have to understand gradle too deep, but the basic thing to understand, otherwise in the Android deployment code, when the error you will be stretched.

Configuring the SDK for Androidstudio

After installing Android Studio, you need to install many of the necessary tools with SDK Manager. If you've previously developed a project using eclipse or an older version of Android studio, you've definitely configured SDK,SDK to be generic, and you just have to find and link to the directory where you installed the SDK Manager. Of course if the SDK has never been installed on your computer, you can download an SDK, double-click Start SDK Manager, and then you will see the SDK manager interface shown .

If you are installing the SDK Manager for the new installation, then there is absolutely nothing installed on it, and the installed on the graph shows that you are uninstall.

To start the installation, proceed as follows:

1) Open sdkmanager-->tools-->option--> first

Put a tick before force https://. OK to close.

2) Choose the platform you need to install and tools such as Android API, because we install Android Studio not only for the development of their own code, but also to read other people's source, the other people's source of the development platform of these tools version is not the same, in order to be compatible with more types of version in the future, And without error, I recommend that you select and install these custom tools at once .

Yes, by the way, science. Because it is installed online, need to visit foreign sites, so in order to be able to download more quickly, in addition to the wall, you can also modify the computer's Hosts file, where is the file? What does it change into? These readers can own Baidu, the content of the hosts is generally provided by some small teams, and will be updated over a period of time. Here is a special reminder, before you change the hosts, remember to put your previous hosts content back up, so if the hosts to a certain time expired, you can also restore a bit, to avoid the network.

What is the difference between so many things installed, and what is the use? Tools , you must install the SDK Platform tool (SDK Platform-tools) and the latest version of SDK build tools, but it is recommended that each version of the Android SDK Build-tools be installed. You can see that there are a lot of Android API version, you do not feel confused about this name, such as Android 4.0 (API 14), Android 4.0 and API 14 is actually two kinds of names, In general, the code is written by the API number (14) of the pattern, such as in Androidmanifest.xml to specify the minimum API version is the 3~21 sequential number to specify. You need to install Android 1.5 (API 3) to all versions of Android 5.0 (API 21). Extras under the Android support repository and Android supports library are tools for supporting libraries (if you use Android studio to install Android support Repository, The use of Eclipse is to install the Android Support Library). Extras USB driver is supported by USB driver, USB drive way There are a variety of, here only the system of USB drive problem only came back here to find.

Gradle Configuration

After you install Android Studio, you also need to download a Gradle installation yourself, taking gradle2.1 as an example.

1) Download Gradle 2.1

2) Extract to a directory, such as d:/anzhuangbao/gradle-2.1

3) Set Gradle in Android studio to open file-> settings->gradle->

you can choose to use the default Gradle wrapper (recommend), Gradle takes the defaults, then you need to configure the system variables, properties, such as advanced system settings, environment variables, and d:/ Anzhuangbao/gradle-2.1/bin; Add the variable to path to the end. Restart the computer, you can test the cmd command box gradle installed, the command is GRADLE-V, if successful will show the Gradle version. or you can choose to use local gradle distribution, and then select your Gradle directory d:/anzhuangbao/gradle-2.1.

If the R file is not recognized in the project

Reason: Your gradle is not working. Then please check and configure your gradle.

What is Gradle?

You can take a source code, open its Build.gradle file to find out.

Let me give you a chestnut, find the Build.gradle file in the Doufm_android directory, and open the view with a Notepad or Notepad. There will typically be two build.gradle, one with the. Gradle folder, the. Ideal folder, and the APK folder, and so on, and you need to go deeper into the folder, looking for, will find a very similar to my this one, that is what we are looking for.

Compilesdkversion 21, instructions to run the source code, you must have installed the Android API 21

Buildtoolsversion 20.0.0 Instructions to run the source code, you must have installed the Android SDK Build-tools 20.0.0

Minsdkverison says down to Android API 14, which is the version of Androd 4.0 to install

Targetsdkverision that the target Android API is API 21 that is Android 5.0

The following dependencies indicate some third-party libraries that need to be used

Gradle files can have more content, more details can be viewed http://wenku.baidu.com/link?url=dU5_gdgmk-NKE9U4Z1fTarFWFXf6jsHHMoxxVwRc0P4ZRr__ Oizhhihisqmola6wqa9fxkdqcfgv3gozz1e7pemg9g58londfobm9g9a8dk




The things about Android Studio and Gradle

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.