Get the App
SLTechnology News&Howtos  ›  Servers  › 

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

Shulou Source: shulou.com Published: 2022-06-01 07:11:40 09月22日 Update

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.

Tags: Code environment success variables articles files more versions prepare compile run good practical content can be passed basic words that is manual copy Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno OPPO Reno Redmi Shulou Information Xiaomi Shulou Tech Info