Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use ant to bulk package apk Environment for Server in Ubuntu

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article will explain in detail how Server in Ubuntu uses ant to build a batch packaging apk environment. The editor thinks it is very practical, so I share it with you for reference. I hope you can get something after reading this article.

Ant environment preparation

The simplest thing is to use:

The code is as follows:

Sudo apt-get install ant

Or manually install:

First, go to the Apache website to download the latest version of ant: http://ant.apache.org/. Extract the downloaded .tar.gz file:

The code is as follows:

Tar-xf apache-ant-1.8.2-bin.tar.gz

2. Move the extracted files to / opt/: sudo mv apache-ant-1.8.2 / opt/ (sudo cannot be saved, otherwise there is no permission)

3. Configure the environment variable: sudo vim / etc/profile, and add the following blue characters to the original:

The code is as follows:

Export ANT_HOME=/opt/apache-ant-1.8.2

Export JAVA_HOME=/usr/lib/jvm/java-6-openjdk

Export PATH=$JAVA_HOME/bin:$PATH:$ANT_HOME/bin

Export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar

4. Verify whether the installation is successful:

The code is as follows:

Ant-version

Apache Ant (TM) version 1.8.2 compiled on December 20 2010

The words like this indicate that the installation is successful!

Android compilation environment preparation

Download adt-bundle-linux-x86_64-20130729.zip or the latest version at http://developer.android.com/sdk/index.html, and extract:

The code is as follows:

Unzip adt-bundle-linux-x86_64-20130729.zip

Copy the extracted sdk directory to / opt/sdk

The code is as follows:

Cp. / adt-bundle-linux-x86_64-20130729/sdk/ / opt/sdk

Set the environment variable:

The code is as follows:

Vim / etc/bash.bashrc

Add at the bottom:

The code is as follows:

Export ANDROID_SDK_HOME=/opt/sdk/

Export PATH=$PATH:$ANDROID_SDK_HOME/tools:$ANDROID_SDK_HOME/build-tools/android-4.3:$ANDORID_SDK_HOME/platforms/android-18/

After saving, run: bash to make the environment variable take effect.

Now you can test your success by running android!

The code is as follows:

Android create project-target "android-18"-name APP-path App-activity MainActivity-package com.yourtion.android

JRE is also needed when compiling and generating APK, which may need to be installed first. I installed JRE7's

The code is as follows:

Sudo apt-get install openjdk-7-jre openjdk-7-jdk openjdk-7-jre-lib

This is the end of this article on "how Server in Ubuntu uses ant to build a batch packaging apk environment". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report