Get the App
SLTechnology News&Howtos  ›  Servers  › 

How to realize the systematic Packaging of android Project

Shulou Source: shulou.com Published: 2022-06-03 06:00:35 09月30日 Update

1. Demand

Realize the systematic packaging of android project and the archiving management of each version of apk and upload it to dandelion platform automatically through dandelion platform API

two。 Mode of realization

Jenkins slave node installs android sdk and gradle

3. Pipeline

Node ('slave-201') {stage ("pull code from gitlab") {checkout ([$class:' GitSCM', branches: [[name:'* *], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[credentialsId: 'certified ID'] Url: 'project address']])} stage ("replace update configuration file and signature file") {sh''/ usr/bin/cd ${WORKSPACE} / usr/bin/rm-rf ${WORKSPACE} / app/build.gradle / usr/bin/cp / root/jenkins/android/build.gradle ${WORKSPACE} / app''} stage ("compile Package and sign package ") {sh''export JAVA_HOME=/usr/local/jdk8 export ANDROID_HOME=/usr/local/android export GRADLE_HOME=/usr/local/gradle cd app/ usr/local/gradle/bin/gradle clean / usr/local/gradle/bin/gradle assembleRelease'''} stage (" Archive ") {archiveArtifacts artifacts:' app/build/outputs/apk/release/app-release.apk' Fingerprint: true} stage ('publish to dandelion platform') {sh'''curl-F 'file=@app/build/outputs/apk/release/app-release.apk'-F' _ api_key=apikey'-F "buildInstallType=2"-F "buildPassword=password" https://www.pgyer.com/apiv2/app/upload''}}

4. Construction result

Tags: Platform dandelion dandelion project file system code address method version result node requirement update management compilation authentication configuration Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Information MySQL vpn OPPO Reno Microsoft