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
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 ~/
Enter the home directory of the current user.
2. Create bash_profile Execute command:
touch .bash_profile
3. Open and edit the bash_profile execution command:
open .bash_profile
4. Configure Gradle:
PATH=$PATH:你的gradle的bin路径
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
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
Three words can be implemented automatically packaged, the last generated APK package in the path:
你项目的根目录/app/build/outputs/apk
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