Jenkins 打包流程简述

前言:有一段时间没更新博客内容,发现自己的知识并不能很好的沉淀下来。这段时间会好好努力让自己沉淀一下,分享一下最近自己在看、在学的一些内容。jenkins打包这块其实很早开始就在接触使用了,但是有一次突然需要重新对一个项目进行jenkins建立打包,才发现也花费了不少时间。于是乎,在这写篇文件记录一下。

一、git仓库

本地代码与gitlab(github)远程仓库做关联,并将代码上传至代码仓库。

二、jenkins的配置

新建jenkins项目空间,进入配置界面,如下图:

《Jenkins 打包流程简述》 image

  1. 配置git仓库URL
  2. 选择分支

《Jenkins 打包流程简述》 image

在构建栏中,完善需要执行的shell脚本。

三、jenkins常见问题

  1. > Could not resolve all dependencies for configuration ':classpath'.
       > Could not find com.android.tools.build:gradle:3.0.0.
    

《Jenkins 打包流程简述》 image

解答: 这个问题是gradle3.0插件依赖未成功加载导致的,在buildscript的repositories中加入google仓库

《Jenkins 打包流程简述》 image

  1. > You have not accepted the license agreements of the following SDK components:
      [Android SDK Build-Tools 26.0.2].
    

    《Jenkins 打包流程简述》 image

    解答:在执行脚本前加入

    yes | $ANDROID_HOME/tools/bin/sdkmanager "build-tools;26.0.2"
    
  2. * What went wrong:
    Execution failed for task ':common:processReleaseResources'.
    > com.android.ide.common.process.ProcessException: Failed to execute aapt
    

《Jenkins 打包流程简述》 image

解答:centOS中使用的glibc的版本过低,需要升级。

  1. Execution failed for task ':app:validateSigningDebug'.
    > Keystore file /Users/lianyuchen/GitHub/ModuleApp/app/keystore.jks not found for signing config 'debug'.
    

《Jenkins 打包流程简述》 image

解答:未找到签名文件

  1. Execution failed for task ':app:lintVitalRelease'.
    > Lint found fatal errors while assembling a release target.
    

《Jenkins 打包流程简述》 image

解答:执行release打包时,出现error就中断了打包。需要在 build.gradle 的 android{} 中增加:

lintOptions {
        checkReleaseBuilds false
        // Or, if you prefer, you can continue to check for errors in release builds,
        // but continue the build even when errors are found:
        abortOnError false
}
    原文作者:ShadowHapiness
    原文地址: https://www.jianshu.com/p/1c5524bd5ff4
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞