Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //You can specify JVM arguments to Gradle daemon by entering a line in ~/.gradle/gradle.properties as shown below.
- org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
- android.enableBuildCache=true
- android.builder.sdkDownload=true
- ######################################################################3
- Use alfi to find the gradle dependency statement for a library
- Its basically the command line version of Gradle, Please which is a web hosted.
- Run
- alfi name_of_library
- ##################################
- Calculate the version code and version name in your build.gradle automatically, based on git information*
- Note: These functions go specifically inside the app's build.gradle and cannot be used with ext.
- In your app's build.gradle
- // Version code is calculated as the number of commits from last commit on master
- def getVersionCode = { ->
- try {
- def code = new ByteArrayOutputStream()
- exec {
- commandLine 'git', 'rev-list', 'HEAD', '--count'
- standardOutput = code
- }
- return Integer.parseInt(code.toString().trim())
- } catch (exception) {
- return "1";
- }
- }
- // Version name is Last Tag Name + No. of commits form last Tag + short git sha
- def getVersionName = { ->
- try {
- def stdout = new ByteArrayOutputStream()
- exec {
- commandLine 'git', 'describe', '--tags', '--dirty'
- standardOutput = stdout
- }
- return stdout.toString().trim()
- } catch (exception) {
- return "0.0.0.1";
- }
- }
- // Use
- android{
- defaultConfig {
- ...
- versionCode getVersionCode()
- versionName getVersionName()
- ...
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement