Install Android SDK on Ubuntu 14.04x64

Source: Internet
Author: User
Tags android sdk manager

Install Android SDK on Ubuntu 14.04x64

Operating System: Ubuntu 14.04x64

Objective: To install the Android SDK

Last updated in this article:

Install the 32-bit Library File

In September 2013, the iPhone 5s was the first 64-bit mobile phone, while Android phones were still 32-bit, one year behind.

The adb program in the Android SDK is 32-bit. A 32-bit library file must be installed in the Ubuntu x64 System for 32-bit programs. If the installation is not performed, adb will encounter an error: java. io. IOException: error = 2

sudo apt-get install -y libc6-i386 lib32stdc++6 lib32gcc1 lib32ncurses5 lib32z1 
Install Android SDK

Install jre

sudo apt-get install openjdk-7-jre

Official download page, select "use an existing ide", download pure SDK without IDE: http://developer.android.com/sdk/index.html

cd ~/Downloads/wget http://dl.google.com/android/android-sdk_r22.6.2-linux.tgztar -zxvf android-sdk_r22.6.2-linux.tgzecho 'export ANDROID_HOME="'$HOME'/Downloads/android-sdk-linux"' >> ~/.bashrcecho 'export PATH="$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools"' >> ~/.bashrc

 

Close the terminal and then enable a terminal to make the environment variable take effect.

Start Android SDK Manager

  android  

Select the latest Android SDK Platform-tools, Samples for SDK, and so on to download (about 2.6 GB ).

Note: You must install Android Support Repository. Otherwise, gradle reports an error.

If the download speed is slow, ping g.cn, set hosts for the dl-ssl.google.com, and select Force https to http in the Android SDK Manager -- "menu --" Tools -- "Options"

Adb identifies question marks on Android devices

Android devices connect to your computer through USB cables.

adb devices
If the display List of devices attached ???????????? No permissions indicates that the device cannot be identified. modify the configuration to identify the device. The steps are as follows.

Run lsusb when you plug in the mobile phone, unplug the mobile phone, and run lsusb. If one line is missing, it is the device.

For example, Bus 002 Device 003: ID 0bb4: 0ccf High Tech Computer Corp. indicates that HTC vendor ID is 0bb4

Xiaomi's 1 s Bus 002 Device 007: ID 18d1: 9025 Google Inc., indicating that Xiaomi's vendor ID is 18d1

Enter the vendor ID, for example, 18d1.

echo 'SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", MODE="0666", GROUP="plugdev"' | sudo tee -a /etc/udev/rules.d/51-android.rulessudo chmod a+r /etc/udev/rules.d/51-android.rulessudo service udev restartadb kill-serveradb start-server

Turn off the "USB debugging" of the device, unplug it, re-connect it to the computer, and then enable "USB debugging ".

adb devices

If the display is normal, you can. If it is a Huawei mobile phone, it still cannot be displayed, please refer:

Use the command to compile and package the Android project: the new method Gradle
Echo to enter a project, such as democd ~ /Downloads/android-sdk-linux/samples/android-19/ui/ActionBarCompat-Styledecho compilation and packaging, automatically download dependent lib and projects. /gradlew assembleDebugecho install adb install ActionBarCompat-StyledSample/build/apk/ActionBarCompat-StyledSample-debug-unaligned.apk on your phone or virtual machine

Starting from android-18, the official demo in the android sdk is packaged using gradle instead of ant.

Advantage: gradle automatically downloads dependent lib and projects. Unlike ant, you can manually download them one by one android update project before compiling this project. I may not understand it when I learned how to do the demo. When a project has 10 dependencies, I find ant is too troublesome and gradle is very convenient.

Reference: http://tools.android.com/tech-docs/new-build-system

Use commands to compile and package Android projects: the old method ant

Ant depends on jdk, so install it first.

sudo apt-get install -y openjdk-7-jdk

To compile a project with ant:

 
Echo to enter a project, such as democd ~ /Downloads/android-sdk-linux/samples/android-17/ApiDemosecho to generate the build. xml file. Android-19 indicates the target OS, which can be viewed using android list targets. If the Android API in the SDK is not installed, the targets is empty. Common examples include "android-19" and "Google Inc.: Google APIs: 19 "android update project-p. -s-t "android-19" echo compilation package, need to install jdkant debugecho to the mobile phone or virtual machine and other devices adb install bin/ApiDemos-debug.apk
How to quickly switch wifi during development

Use WiFi List widget Free (including notification bar ads. Switch to another wifi instance in one second on the desktop without switching to system settings. : Https://play.google.com/store/apps/details? Id = pl. rkmiec. wifilist. free & hl = zh_CN

:

For more details, please continue to read the highlights on the next page:

  • 1
  • 2
  • Next Page

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.