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 build Android environment on Ubuntu system and download APK from Google Play

2025-03-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This article mainly explains "how to build Android environment on Ubuntu system and download APK from Google Play". The content in this article is simple and clear, easy to learn and understand. Please follow the editor's train of thought to study and learn "how to build Android environment on Ubuntu system and download APK from Google Play".

Create a full command line Android construction system

Step 1 installs JDK environment

It is best to choose the official version of JDK instead of Open JDK for JDK with android. Here is how to install JDK 1.7 under unbuntu.

The code is as follows:

Sudo add-apt-repository ppa:webupd8team/java

Sudo apt-get update

Sudo apt-get install oracle-java7-installer

Step 2 install Android SDK

Some of the command line tools of the android sdk toolkit are based on 32-bit systems. To run 32 programs on 64 for the platform, you must install some i386 dependent libraries as follows:

The code is as follows:

Sudo dpkg-add-architecture i386

Sudo apt-get update

Sudo apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386 lib32z1

After installing the 32-bit dependent library, we use wget to officially download the latest android SDK package under linux.

The code is as follows:

Cd ~

Wget http://dl.google.com/android/android-sdk_r24.0.1-linux.tgz

Tar xvzf android-sdk_r24.0.1-linux.tgz

Edit .profile or .bash _ profile to add the following directory to the path search path to make sure that some of android SDK's command tools can be used directly on the terminal, such as the adb command.

The code is as follows:

ANDROID_HOME=$HOME/android-sdk-linux

Export PATH= "$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools"

Exprot ANDROID_HOME

Make the environment variable effective

The code is as follows:

Source / .profile

After the environment variable takes effect, you can use the android command to make a list of sdk-related items so that we can choose the version of SDK that matches our project. (just installed the most basic SDK, to fully meet the needs of your development environment, you have to select the SDK and tool updates you need from the list below.)

The code is as follows:

Android list sdk-all

The output is as follows:

1-Android SDK Tools, revision 24.0.1

2-Android SDK Platform-tools, revision 21

3-Android SDK Build-tools, revision 21.1.2

4-Android SDK Build-tools, revision 21.1.1

5-Android SDK Build-tools, revision 21.1

6-Android SDK Build-tools, revision 21.0.2

7-Android SDK Build-tools, revision 21.0.1

8-Android SDK Build-tools, revision 21

9-Android SDK Build-tools, revision 20

10-Android SDK Build-tools, revision 19.1

11-Android SDK Build-tools, revision 19.0.3

12-Android SDK Build-tools, revision 19.0.2

13-Android SDK Build-tools, revision 19.0.1

14-Android SDK Build-tools, revision 19

15-Android SDK Build-tools, revision 18.1.1

16-Android SDK Build-tools, revision 18.1

17-Android SDK Build-tools, revision 18.0.1

18-Android SDK Build-tools, revision 17

19-Documentation for Android SDK, API 21, revision 1

20-SDK Platform Android 5.0.1, API 21, revision 2

21-SDK Platform Android 4.4W.2, API 20, revision 2

22-SDK Platform Android 4.4.2, API 19, revision 4

23-SDK Platform Android 4.3.1, API 18, revision 3

24-SDK Platform Android 4.2.2, API 17, revision 3

....

This includes different versions of Android API and different build tools. Select the serial number of the project you want to install. Here I want to install build tools 19.1, build tools 21 and android 4.2.2 and above SDK, so I choose the serial number "1meme 2meme 3meme 20ret 21pje 2223".

The code is as follows:

Android update sdk-u-a-t 1, 2, 3, 10, 20, 20, 21, 22, 23

Step 3 install gradle build environment

Building projects using Ant is a thing of the past, and here we choose the more powerful and convenient build tool gradle.

Download grdle binary package

The code is as follows:

Cd ~

Wget https://services.gradle.org/distributions/gradle-2.2.1-bin.zip

Release to the local Home directory and create a symbolic link named "gradle". The advantage of symbolic link is that it is convenient to update the version, and you can modify the symbolic link directly with the new version.

The code is as follows:

Unzip gradle-2.2.1-bin.zip

Ln-s gradle-2.2.1 gradle

Configure the gradle environment variable to take effect, and edit the ~ / .profje file to add the following

The code is as follows:

GRADLE_HOME=$HOME/gradle

Export PATH=$PATH:$GRADLE_HOME/bin

Make the environment variable take effect after saving

The code is as follows:

Source / .profile

After the environment variable takes effect, you can type the 'gradle' command on the terminal and run it to check whether the gradle is installed successfully.

The code is as follows:

Gradle

If there is no problem with the installation configuration, you will be prompted with information similar to the following

The code is as follows:

: help

Welcome to Gradle 2.2.1

To run a build, run gradle...

To see a list of available tasks, run gradle tasks

To see a list of command-line options, run gradle-- help

BUILD SUCCESSFUL

Verify that the android application can be compiled

After completing the above environment configuration, we have all configured the basic construction environment under Android. The next thing to do is to try to compile an android application using gradle to verify whether my compilation environment is OK or not, and download a gadle demo example I wrote for testing.

The code is as follows:

Git clone https://github.com/examplecode/gradle_demo

Cd gradle_demo/hello-apk-with-gradle

Gradle build

How to download an apk file from a Google Play store on Linux

Python requirements

GooglePlayDownloader requires Python with SNI (Server Name Indication server name indication) to support SSL/TLS communication, which was introduced by Python version 2.7.9 or later. This makes some older distributions such as Debian 7 Wheezy and earlier, Ubuntu 14.04 and earlier, or CentOS/RHEL 7 and earlier can not meet this requirement. Assuming you already have a distribution with Python 2.7.9 or later, you can install GooglePlayDownloader as follows.

Install GooglePlayDownloader on Ubuntu

On Ubuntu, you can use the officially built deb package. One condition is that you may need to install a required dependency manually.

On Ubuntu 14.10

Download the python-ndg-httpsclient deb package, which is a missing dependency in an older Ubuntu distribution. Also download GooglePlayDownloader's official deb package.

The code is as follows:

$wget http://mirrors.kernel.org/ubuntu/pool/main/n/ndg-httpsclient/python-ndg-httpsclient_0.3.2-1ubuntu4_all.deb

$wget http://codingteam.net/project/googleplaydownloader/download/file/googleplaydownloader_1.7-1_all.deb

As shown below, we will use the gdebi command to install these two deb files. The gedbi command will automatically handle any other dependencies.

The code is as follows:

$sudo apt-get install gdebi-core

$sudo gdebi python-ndg-httpsclient_0.3.2-1ubuntu4_all.deb

$sudo gdebi googleplaydownloader_1.7-1_all.deb

On Ubuntu 15.04or later

Recent Ubuntu distributions are already equipped with all the required dependencies, so the installation process can proceed directly as below.

The code is as follows:

$wget http://codingteam.net/project/googleplaydownloader/download/file/googleplaydownloader_1.7-1_all.deb

$sudo apt-get install gdebi-core

$sudo gdebi googleplaydownloader_1.7-1_all.deb

Install GooglePlayDownloader on Debian

Due to its Python requirements, Googleplaydownloader cannot be installed on Debian 7 Wheezy or earlier unless you upgrade its own version of Python.

On Debian 8 Jessie and later:

The code is as follows:

$wget http://codingteam.net/project/googleplaydownloader/download/file/googleplaydownloader_1.7-1_all.deb

$sudo apt-get install gdebi-core

$sudo gdebi googleplaydownloader_1.7-1_all.deb

Install GooglePlayDownloader on Fedora

Since GooglePlayDownloader was originally developed for Debian-based distributions, if you want to use it on Fedora, you need to install it from its source code.

First install the necessary dependencies.

The code is as follows:

$sudo yum install python-pyasn1 wxPython python-ndg_httpsclient protobuf-python python-requests

Then install it as below.

The code is as follows:

$wget http://codingteam.net/project/googleplaydownloader/download/file/googleplaydownloader_1.7.orig.tar.gz

$tar-xvf googleplaydownloader_1.7.orig.tar.gz

$cd googleplaydownloader-1.7

$chmod otakr-R.

$sudo python setup.py install

$sudo sh-c "echo 'python / usr/lib/python2.7/site-packages/googleplaydownloader-1.7-py2.7.egg/googleplaydownloader/googleplaydownloader.py' > / usr/bin/googleplaydownloader"

Download the APK file from the GooglePlay store using GooglePlayDownloader

Once you have installed GooglePlayDownloader, you can download the APK file from the GooglePlay store as below. (LCTT translation note: obviously you need to make your Linux climb ladders)

First start the application by entering the following command:

The code is as follows:

$googleplaydownloader

In the search bar, enter the name of the app you want to download from the Google Play store.

Once you have found the app in the search list, select it and click the "download selected APK file" button. Finally, you will find the downloaded APK file in your home directory. Now you can transfer the downloaded APK file to the Android device of your choice and install it manually.

Thank you for reading, the above is the content of "how to build Android environment on Ubuntu system and download APK from Google Play". After the study of this article, I believe you have a deeper understanding of how to build Android environment on Ubuntu system and download APK from Google Play, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

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