Android unified tools

The project is integrated, developed using commonly used tools, GitHub address , original address

A: statement

The project is only for your own use and without project attacker, because the contents of a single and simple

Two: Background

I am an Android developer, in the normal development process, often using some tools, such as: time conversion tools, tools to save the file, picture capture tools ... if at this time you are participating in a project that okay What if the new method, you can directly modify tools, that if you are participating in a number of projects at this time (simultaneous and non-simultaneous all have this problem) If you need to use the tools that you will need in each modification of project tools corresponding method, is not it trouble in the previous work which also encountered a similar situation a lot, so they have an idea, see if you can use the usual tools to put together a unified look, in the project depend directly on the lib, so it will be convenient, one is your main project less code, clear thinking, and the other is easy to maintain your tools, it is hoped that this method can be who has put up a good tool, for everyone to learn and use.

3: How to use Project Introduction

  • Project structure:

      app.......................................(项目目录,主要是用于测试jdutil).................
          src......................................................................................
          build.gradle...........................(主项目配置文件)................................
      gradle.......................................................................................
      jdutil......................................(工具类Module)...................................
          src......................................................................................
          build.gradle...........................(工具类配置文件,及打包命令)....................
      build.gradle.................................................................................
      config.gradle..............................(使得主项目和moduel版本一致)....................
    
  • how to use:

      step1:将jdutil--jdUtilV1.0.0.jar(1.0.0 为版本号,可能会发生改变)  复制到你要使用的项目的module的libs 中
      step2:在该module的build.gradle 中找到 dependencies标签,添加implementation fileTree(include: ['*.jar'], dir: 'libs') 和 添加 implementation files('libs/jdUtilV1.0.0.jar')
    

note:

If you want to use more tools to configure the module has been completely, but if you want (referring to non-appmodule, but other moduel) in your sub-module is added in, but you want to use in the primary article , then
the implementation files ( 'libs / jdUtilV1.0.0.jar' ) is amended as implementation api, otherwise it can not be used in appModule, the specific reasons please see

Four: New tools methods, how to package

Tools unified method put to jdutil-src-main-java- cn.ddh.jdutil down
after more than ready all the work, compile a jar

  • Method 1:
    Open AndroidStudio upper right side Gradle directory, find jdutil-> Tasks-> other-> makeJar double-click makeJar wait compiled
    Described here
  • Second way:
    Open AndroidStudio below the Terminal tool in ensuring that the path is under JdUtilTest, enter gradlew makeJar Enter compiled wait
    Here Insert Picture Description

Note:
Either way, in fact, the principle is the same, packaging commands and configuration definition build.gradle at jdutil directory
def _BASENAME = jar of names such as jdUtil
DEF _VERSION = jarInfo.versionName; for example, JAR version V1.0.0
DEF _DestinationPath = jarInfo.destinationPath; generating jar package position
Here Insert Picture Description

Five: expectations

Hope this utility class to accommodate an increasing number of methods for the benefit of each project

Content if different, please correct me, thank you!

Released five original articles · won praise 3 · Views 2044

Guess you like

Origin blog.csdn.net/qq_36652498/article/details/104069385