2014Android development Environment installation and support library installation

Source: Internet
Author: User
Tags android sdk manager

Purely personal interest, want to learn about Android development. Brother had 5 years before Windows. NET development experience, and Windows Form is very well-played by ASP. Unexpectedly, a contact with Android is dumbfounded, completely different Ah, elder brother do not understand AH. Android Development is very fast, if it is 11, 12, 13, Android technology articles, do not look, otherwise will go a lot of detours, said more are tears ah.

First, installation

The first question is how to install the Android development environment. Complicating point is the need for Java SDK + Eclipse (IDE) + ADT (Android developer Tools), as a novice, I do not recommend to install one by one because it is too cumbersome. Google Android's website is highly recommended: https://developer.android.com/index.html, go directly to the official website to download the installation package that integrates all the development tools (packaged, next). is: https://developer.android.com/sdk/index.html

This installation package has been integrated with the following features:

With a single download, the Eclipse ADT bundle includes everything your need to begin developing apps:
Eclipse + ADT Plugin//eclipse and ADT Plugins
Android SDK Tools//android Development Tools
Android Platform-tools//android Platform Tools
A version of the Android platform//android supported in various editions
A version of the Android system image for the emulator//android systems picture and simulator


If you are a veteran, it is also strongly recommended to use this installation package, for what, because of the general well-known reasons, do not flip the wall can not update the east of the ADT.

In Java, the veteran will do it? But I'm an amateur, so I just understand. Download the JDK (Java Developer Kit), and don't just lower the JRE (Java Runtime enviroment, which just executes the Java program and cannot compile Java code). Go to the www.oracle.com to download a good one. Available on official website: http://www.oracle.com/technetwork/java/javase/downloads/index.html, download Java SE 1.7, this page: http://www.oracle.com/ Technetwork/java/javase/downloads/jdk7-downloads-1880260.html

Another point, it is recommended to download x86, not under the 64-bit, even if you are 64 for the machine, because the online tutorials and most of the tools for x86 support better.

Finally, summarize:

1, JDK 1.7 (file name is this: Jdk-7u71-windows-i586.exe), installed, see if you need to configure the Java environment, if necessary please Baidu.

2, Adt-bundle-windows-x86-20140702.zip, decompression can be used.

Second, Android low version support

Brother from the Internet under an Android open source project, opened after the discovery of a problem, the problem is described as follows:

Error:error Retrieving parent for item:no Resource found that matches the given name ' @style/theme.appcompat '.
So brother full Baidu and Google to find, the last, or the elder brother to solve their own. Let's talk about Android's low-version support.

The Android version is growing very fast, as if it were a 1.6 version, and now it's 4.4. If you are developing an app that wants to support a low version, you need to add support for the lower version. For example, when creating a new Android project, there is a choice, Minimum Required SDK, which is the minimum supported version.

Google offers a package of Android support Library packages to ensure compatibility with high-version SDK development, that is, when we develop with 4.x, we can use some features of the higher version, such as Fragement, in the 1.6 version. Viewpager, below, briefly explain the differences between these versions:
Android Support V4: This package is designed to take care of 1.6 and later, this package is the most widely used, Eclipse new project, when the default comes with.
Android Support V7: This package is designed to take care of 2.1 and above, but does not include lower, so if you do not consider 1.6, we can add this package, in addition to note that V7 is to rely on V4 This package, that is, two must be included at the same time.
Android Support V13: This package is designed for Android 3.2 and later, generally we are not used, tablet development can be used.

In addition, set up, in the androidmanifest.xml can also be modified, android:minsdkversion= "8", refers to the Android2.2 above.

In short, you just have to take care of V7 a support package is enough because V7 relies on V4. Of course, in the development process, if you really need to support the version below 2.1, there are some differences in the wording.


explained the ins and outs, and now began to solve the problem. Let's stick to an official note, it's not that complicated.

Create a library project based on the Support library code:

  1. Make sure has downloaded the Android support Library using the SDK Manager.
  2. Create a library project and ensure the required JAR files is included in the project ' s build path:
    1. Select File > Import.
    2. Select Existing Android Code into Workspace and click Next.
    3. Browse to the SDK installation directory and then to the support Library folder. For example, if is adding the appcompat project, browse to <sdk>/extras/android/support/v7/appcompat/ .
    4. Click Finish to import the project. For the V7 AppCompat project, you should now see a new project titled Android-support-v7-appcompat.
    5. The new library project, expand libs/ the folder, right-click each .jar file and select Build Path > Add to Bui LD Path. For example, when creating the V7 AppCompat project, add both the and android-support-v4.jar files to the android-support-v7-appcompat.jar build path.
    6. Right-click the project and select Build path > Configure build Path.
    7. In the Order and Export tab, check the .jar files you just added to the build path, so they is available to Pro Jects that depend in this library project. For example, the appcompat project requires your to export both the android-support-v4.jar and android-support-v7-appcompat.jar files.
    8. Uncheck Android Dependencies.
    9. Click OK to complete the changes.

You are now having a library project for the your selected support library so you can use with one or more application projects.

ADD the library to your application project:

    1. in The project Explorer, right-click your project and select  Properties .
    2. in the Library pane, click  Add .
    3. select the Library project and click  OK . For example, The appcompat   Project should be listed as  android-support-v7-appcompat .
    4. in the Properties window, click  OK .

Once your project is a set up with the support library, here's how to add the Action bar:

  1. Create your activity by extending ActionBarActivity .
  2. Use (or extend) one of theTheme.AppCompatThemes for your activity. For example:
    <span class= "tag" style= "Color:rgb (0, 0, 136);" ><activity</span><span class= "PLN" style= "Color:rgb (0, 0, 0);" > </span><span class= "atn" style= "Color:rgb (136, 34, 136);" >android:theme</span><span class= "pun" style= "Color:rgb (102, 102, 0);" >=</span><span class= "ATV" style= "Color:rgb (0, 136, 0);" > "@style/theme.appcompat.light" </span><span class= "PLN" style= "Color:rgb (0, 0, 0);" > </span><span class= "tag" style= "Color:rgb (0, 0, 136);" >></span> 

Now your activity includes the action Bar is running on Android 2.1 (API level 7) or higher.

On API level one or higher

The action Bar is included with all activities Theme.Holo so use the theme (or one of it descendants), which is the default th The EME when either the targetSdkVersion or minSdkVersion attribute are set to "11" or higher. If you don't want the action bar for a activity, set the activity theme to Theme.Holo.NoActionBar .

It 's basically two steps.

1, add V7 Project, file->new->project->android project from Existing code-> Select the directory for Adt-bundle-windows-x86-20140702.zip (specifically this directory:<sdk>/extras/android/support/v7/appcompat/), Then the V7 project was set up, the above English is very complex, in fact, nothing else to set.

2, in your own project, only need to set up a place: Right-click your project (if you like the menu, you can also left-click to select your project, and then open from the menu project), select Propeties, and then select the Android this project, Then click the Add button at the bottom right to add android-support-v7-appcompat, other than the same without setting.



In addition, under the Eclipse->windows->android SDK Manager can update other packages, not even at all (online most of the tutorials said to update this, Tai hang), if you want to use this update, it is recommended to flip the wall. If you are downloading a full installation package from the official website, this update should not be necessary.




2014Android development Environment installation and support library installation

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.