How to build a command line Android development environment in Linux

Source: Internet
Author: User

How to build a command line Android development environment in Linux

How to build a command line Android development environment in Linux

1. Preface
2. install Java and Ant
3. Android SDK Installation
4. Basic commands for Android Projects

 

I. Preface

This blog post records the creation of the Full-command-line Android development environment in Linux. The content of this article is based on the following articles:

Http://zyqhi2010.blog.163.com/blog/static/171589378201261093235290/ (Emacs-based Android development environment in Linux)
Https://linux.cn/article-5966-1.html (build a full-command-line Android build system)
Http://stackoverflow.com/questions/25646856/android-sdk-tools-ant-build-xml698-null-returned-1 (android-sdk/tools/ant/build. xml: 698: null returned: 1)
Http://blog.chinaunix.net/uid-20665441-id-1758913.html (command line related to android project)
Http://my.oschina.net/u/559701/blog/75333? Fromerr = iCEvYcVH (use ant in linux to create and compile an Android Project)
Http://blog.csdn.net/zhangzeyuaaa/article/details/40047585 (manually create, build, and install android Projects)
Http://blog.csdn.net/xieyan0811/article/details/7400137 (using Ant to compile Android projects (Linux ))

 

Ii. install Java and Ant

For the installation of Java in Linux, refer to the previous blog: Java learning experience to build a Java environment in Linux.

For how to install Ant in Linux, refer to the previous blog: how to install and use ant in Linux.

 

3. Install the Android SDK

1. Download the Linux version of android SDK and decompress it.

2. 64-bit systems need to install corresponding packages. There are various explanations on the Internet, such as libc6: i386, libncurses5: i386, libstdc ++ 6: i386, and lib32z1.
Note: Only the lib32z1 package is installed this time to complete environment setup.

3. in/etc/profile, configure the environment variables as follows:

# set Android environmentexport ANDROID=/home/xp/Documents/SDK/Androidexport PATH=$PATH:$ANDROID/tools:$ANDROID/platform-tools

4. Enter android in the terminal and download the corresponding version of Android SDK tools

 

Iv. Basic commands for Android Projects

(1) view the optional android platform ID:

android list target

 

(2) create a new android project:

android create project -n HelloWorld -t 1 -p ./ -k com.fxt.helloworld -a Helloworld

-N: name of the specified project
-T specify the android platform
-P specifies the Project Storage path
-K specifies the project package name
-A: Specifies the Activity name.

 

(3) compile the project


A) Compile the debug version.

$ ant debug

Generate an apk with the debug Signature

 

B) generate the release version.

$ ant release

Generate an unsigned apk and then manually sign it.

 

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.