Ubuntu 15.10 x64 Install Android SDK

Source: Internet
Author: User
Tags android sdk manager



Operating system: Ubuntu 15.10 x64



Target: Install the Android SDK



This article was last updated: 2015-11-3


Installing 32-bit library files


The September 2013 iphone 5s was the first 64-bit mobile phone, and Android phones mostly used 32-bit systems that lagged behind for two years.



The ADB program in the Android SDK is 32-bit, and the Ubuntu x64 system needs to install 32-bit library files for compatibility with 32-bit programs. If you do not install, ADB will make an error: java.io.ioexception:error=2


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




Installing the Android SDK


Installing the JDK


sudo apt-get install OPENJDK-7-JDK


Official download page, select "Use an EXISTING ide", download the Pure SDK without IDE: official website http://developer.android.com/sdk/index.html, domestic mirror http://gmirror.org/ #android-sdk-tools-only


cd ~/Downloads/
wget http://dl.gmirror.org/android/android-sdk_r24.4.1-linux.tgz
tar -zxvf android-sdk_r24.4.1-linux.tgz
echo ‘export ANDROID_HOME="‘$HOME‘/Downloads/android-sdk-linux"‘ >> ~/.bashrc
echo ‘export PATH="$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools"‘ >> ~/.bashrc
echo ‘export JAVA_CMD="/usr/lib/jvm/java-7-openjdk-amd64/bin/java"‘ >> ~/.bashrc





Turn off terminal, and then turn on a terminal for the environment variable to take effect.



Launch Android SDK Manager


  Android  


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



Note: Be sure to install Android support Repository, otherwise gradle will error.



If the download speed is slow, there are 2 ways:



1, with Hosts:ping g.cn, to set up the hosts for dl-ssl.google.com, and in the Android SDK manager--"menu-" tools--"options selected" Force HTTPS to HTTP "



2, Domestic CDN image download: Todo


ADB identifies blank or question marks on Android devices


The Android device connects to the computer via a USB cable. Execute command:


ADB devices


If blank or question marks are displayed (List of devices attached???????????? No permissions), stating that the device cannot be identified, modify the configuration, and follow the steps below.












Run when you plug in your phone


Lsusb


Unplug the phone and run Lsusb, one less line, that is the device.



such as bus 002 Device 003:id 0BB4:0CCF High Tech computer Corp. Indicates that HTC's vendor ID is 0BB4



Xiaomi 1S's Bus 002 Device 007:id 18d1:9025 Google Inc., which indicates that Xiaomi's manufacturer ID is 18D1



The hammer phone Smartisan T1 is the bus 003 Device 019:id 29a9:7019, indicating that the hammer's manufacturer ID is 29a9



Fill in according to the manufacturer ID, such as Hammer T1 write:


echo ‘0x29a9‘ | tee -a ~/.android/adb_usb.ini
echo ‘SUBSYSTEM=="usb", ATTR{idVendor}=="29a9", MODE="0666", GROUP="plugdev"‘ | sudo tee -a /etc/udev/rules.d/51-android.rules
sudo chmod a+r /etc/udev/rules.d/51-android.rules
sudo service udev restart
adb kill-server
adb start-server


Turn off the "USB debugging" of the device, unplug it, reconnect it to the computer, and turn on "USB debugging".


ADB devices


If the display is normal, you can.












Official Document: Http://developer.android.com/tools/device.html



Hammer Forum: http://bbs.smartisan.cn/thread-59957-1-1.html



If it is a Huawei phone and still cannot be displayed, please refer to: http://blog.csdn.net/aryang/article/details/16843235


Compiling and packaging Android projects with commands: New method Gradle
echo into a project, such as a demo
cd ~ / Downloads / android-sdk-linux / samples / android-23 / ui / ActionBarCompat-Styled
echo compile and package, automatically download dependent libs and projects
./gradlew assembleDebug
Echo is installed on mobile phones or virtual machines
adb install ActionBarCompat-StyledSample / build / apk / ActionBarCompat-StyledSample-debug-unaligned.apk


Starting with Android-18, the official demo in the Android SDK is packaged with Gradle and no longer using ant packaging.



Pros: Gradle will automatically download dependencies, not like ant to manually download lib, and put third-party things in their own code base can not follow up the upgrade, but also one by one Android update Project, and then to compile the project. Learning to do the demo may not realize that when a project has 10 dependencies, it is found that ant is too troublesome, gradle is very convenient.



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





Compiling a packaged Android project with commands: Old method ant


Install Ant:


sudo apt-get install-y ant


Steps for ant to compile a project:


echo into a project, such as a demo
cd ~ / Downloads / android-sdk-linux / samples / android-17 / ApiDemos
echo generates a build.xml file. android-19 is the meaning of the target OS, you can view using android list targets. If the Android API in the SDK is not installed, the targets are empty error. Common ones are "android-19" and "Google Inc.:Google APIs: 19"
android update project -p. -s -t "android-19"
echo compile and package, requires jdk
ant debug
Echo is installed on mobile phones or virtual machines
adb install bin / ApiDemos-debug.apk 




How to quickly switch WiFi during development


Use the WiFi List widget free (with notification bar ads). Switch to another WiFi for 1 seconds on the desktop without having to switch in the system settings. : Https://play.google.com/store/apps/details?id=pl.rkmiec.wifilist.free&hl=zh_CN








Network Debugging Android


Android can be installed using a network (WiFi or wired) without having to connect to the USB cable every time.



Requirements: The device needs root



Method 1: Start "terminal" in the device (if not, install one on the market), and execute the command in the device terminal:


Susetprop service.adb.tcp.port 5555stop Adbdstart adbd


Connect the device with a USB cable to the computer, and the phone pops up "developer Authorization" and agrees to remember.



To execute a command on your computer:


ADB Connect 192.168.199.193ADB devices


It is convenient to compile and install in the future, can be directly identified in Eclipse, with the command line, such as:


Adb-s 192.168.199.193:5555 Install bin/demo-debug.apk


Method 2, use the app to perform the above operation automatically, install WiFi adb-debug over air, https://play.google.com/store/apps/details?id=com.ttxapps.wifiadb








How to install Google Play


For legal reasons, mainland licensed mobile phones cannot integrate Google Play. For more information, see: http://www.zhihu.com/question/20892245



If development requires, download the corresponding GAPPS package according to the Android version, reboot to recovery, and swipe in the package. : Http://www.appkg.com/gapps or Http://wiki.cyanogenmod.org/w/Google_Apps or domestic image download: http://gmirror.org/#gapps



After the swipe in, the restart will be able to see Google Play, if not successfully installed, unzip the zip package, using root Explorer to copy all the Gapps-xxxx/system/app apk into the system/system/app, reboot.


Create an Android project using commands


The official documentation is described in detail: http://developer.android.com/intl/zh-cn/training/basics/firstapp/creating-project.html#CommandLine


How to troubleshoot Android Emulator virtual machine too card


Install VirtualBox, download www.android-x86.org the latest ISO, install, will not card. You can use the network to debug Android.



Detailed steps: http://www.apkbus.com/android-43835-1-1.html



Android Official arm virtual machine is not using "CPU virtualization", so very card. VirtualBox and iOS VMs are all x86 and can call "CPU virtualization Technology", which is smooth.


Ide


Recommended to use the new, currently Google main push Android studio, see: Http://tools.android.com/download/studio/canary/latest, domestic image download:/http gmirror.org/#android-studio



Old company old project will use Eclipse, see: http://www.cnblogs.com/sink_cup/archive/2011/10/31/ubuntu_x64_eclipse_android_sdk_java.html









Http://www.cnblogs.com/sink_cup/archive/2011/10/31/ubuntu_x64_android_sdk_java.html



Ubuntu 15.10 x64 Install Android SDK (GO)


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.