• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

splatte/gradle-android-appiconoverlay: Plugin for Android Gradle to automaticall ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

splatte/gradle-android-appiconoverlay

开源软件地址(OpenSource Url):

https://github.com/splatte/gradle-android-appiconoverlay

开源编程语言(OpenSource Language):

Groovy 100.0%

开源软件介绍(OpenSource Introduction):

gradle-android-appiconoverlay

Plugin for Android Gradle to automatically overlay the app icon with information about the current build: git branch name and commit SHA1.

Example

Example: app icon with overlay

Usage

  1. This plugin is published on JCenter. Add dependency in your Android project's top-level build.gradle file:

    buildscript {
        dependencies {
            classpath 'com.github.splatte:gradle-android-appiconoverlay:2.0'
        }
    }
  2. Apply the plugin in your app module's build.gradle file:

    apply plugin: 'app-icon-overlay'
    appiconoverlay {
        /* then see below for configuration options */
    }
    
    android {
        /* project config */
    }
  3. For those using Gradle 3.+ disable aapt2 in your app module's gradle.properties file:

    android.enableAapt2=false
  4. You will need convert from the ImageMagick project to do the image processing. You can install it using a command along the lines of:

    # debian/ubuntu
    sudo apt-get install imagemagick
    
    # osx
    sudo port install imagemagick
    sudo brew install imagemagick
    
    # required on osx otherwise imagemagick (silently) goes into an infinite loop complaining about missing fonts
    sudo brew install ghostscript

The plugin will hook into your build process automatically and overwrite the target app icon files for debug builds. It will not mess with any files in your repository.

Customization

The plugin offers some options for customizing the appearance of the generated icon. Simply add a block to your app module's build.gradle:

appiconoverlay {
    textColor '#FFF'                  /* #rrggbbaa format */
    backgroundColor "#0008"           /* #rrggbbaa format */
    format '$build->$branch\n$commit' /* GString */
    imageMagick 'convert'             /* command to run ImageMagick */
}
Option Description
textColor Text color in #rrggbbaa format.
backgroundColor Background color for overlay in #rrggbbaa format.
format Format string to be used to create the text in the overlay.
Note: Use single quotes, it's a GString.
The following variables are available:
  • $branch name of git branch
  • $commit short SHA1 of latest commit in current branch
  • $build the name of the build variant ex. Debug
imageMagick Command to run ImageMagick's "convert".

Building locally

If you want to make changes to the plugin, here's how you can build it locally and test it with an Android app:

  1. Check out the project using git.
  2. In the root directory, run gradle jar.
  3. Find the generated .jar file in ./build/libs/.
  4. To reference your local .jar file in your Android project, declare the dependency as follows in the project's top-level build.gradle file:
    buildscript {
        dependencies {
            classpath files('/path/to/gradle-android-appiconoverlay/build/libs/gradle-android-appiconoverlay-2.0.jar')
        }
    }

Credits

Idea based on the IconOverlaying project by Krzysztof Zabłocki, which implements a similar feature for iOS builds.




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
palantir/gradle-gitsemver发布时间:2022-06-12
下一篇:
xvik/gradle-quality-plugin: Gradle quality plugin for Java and Groovy发布时间:2022-06-12
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap