Configure Android Auto-packaging on Mac and Windows

Source: Internet
Author: User

Configure the automatic packaging script, the first is to configure the Gradle command, here you assume that you already have an Android development environment.

Configure gradle on window:
Select computer = "Right-click property =" Advanced system settings = "Advanced =" Environment variable = "system environment variable; find path; In the end, add your Gradle bin path:


I gradle here the path:

C:\Users\Administrator\.gradle\wrapper\dists\gradle-3.3-all\55gk2rcmfc6p2dg9u9ohc3hw9\gradle-3.3\bin
    • 1

If you've installed Androidstudio or eclipse, you can go to this path to see it, or you can download it yourself and extract it to the path you think is appropriate.
Finally open command cmd: input gradle-v
You see the following effect indicating a successful configuration:

Configure Gradle on Mac:
Configuring Gradle on Mac a little bit different but the idea is actually the same
Home Open configuration file via terminal:
1. Enter

cd ~/
    • 1

Enter the home directory of the current user.
2. Create bash_profile Execute command:

touch .bash_profile
    • 1

3. Open and edit the bash_profile execution command:

open .bash_profile
    • 1

4. Configure Gradle:

PATH=$PATH:你的gradle的bin路径
    • 1

Last Save configuration exit, enter Gradle-v, you will see the following results

Indicates a successful configuration, if not, otherwise, if the command line is invalidated because of a configuration error, if this occurs, you can first execute the following command at the terminal:

PATH=/usr/bin:/usr/sbin:/bin:/sbin:/usr/X11R6/bin
    • 1

Make the command available temporarily, then repeat the top step to modify the configuration until the configuration is successful

Tip: If you use the Gradle path directly on the Mac as if there is a problem, guess it should be the path with spaces and the like characters do not know, I here the solution directly copy one copy to the other directory, and then reference

At this point we have successfully configured the Gradle command on both Windows and Mac, in fact we can implement the script to automatically package, below or simply introduce the following command:

cd 你的项目的根目录/appgradle cleangradle build
    • 1
    • 2
    • 3

Three words can be implemented automatically packaged, the last generated APK package in the path:

你项目的根目录/app/build/outputs/apk
    • 1

If interested, can be written as an executable script, next time directly click on the package to build apk
Of course, these are still not enough to meet our needs, we can build a Jenkins environment, the automatic packaging script put on, each test needs to install the package, it can be automatically generated.
We can also write on the automatic update svn or git source code, automatically after the completion of the package, automatically submitted to SVN or git, and even can add timed packaging.

Configure Android Auto-packaging on Mac and Windows

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.