簡體   English   中英

詹金斯 Android groovy.lang.MissingPropertyException: 沒有這樣的屬性: 類的 HOME: groovy.lang.Binding

[英]Jenkins Android groovy.lang.MissingPropertyException: No such property: HOME for class: groovy.lang.Binding

我很開始詹金斯。 我按照本教程自動發布應用程序來播放商店。 https://medium.com/mindorks/automating-android-app-play-store-publishing-via-jenkins-a6c30dbc59dd

我一開始就收到此錯誤消息。

groovy.lang.MissingPropertyException:沒有這樣的屬性:類的家:groovy.lang.Binding

def home = sh(script: "echo $HOME",returnStdout: true).trim()
        def SDKPath = "$home/Android/SDK"
        stage("Preparing SDK"){
            // Check SDK Downloaded
            def isSDKDownloaded = sh(script: "test -e sdk-tools-linux-4333796.zip && echo true || echo false",returnStdout: true).trim()
            if(isSDKDownloaded == "false"){
                // Download SDK
                sh "wget 'https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip'"
            }
            // Check if SDK is Extracted
            def isExtracted = sh(script: "test -e $SDKPath/tools && echo true || echo false",returnStdout: true).trim()
            if(isExtracted == "false"){
                sh "mkdir -p $SDKPath"
                //Unzip SDK
                sh "unzip sdk-tools-linux-4333796.zip -d $SDKPath"
            }
// Install SDK Tools
            sh "yes | $SDKPath/tools/bin/sdkmanager 'build-tools;28.0.3' 'platform-tools' 'platforms;android-27'"
sh "ls $SDKPath/licenses"
            // See installed And Available SDK
            sh "$SDKPath/tools/bin/sdkmanager --list"
            // Accept All SDK Licences
            sh "yes | $SDKPath/tools/bin/sdkmanager --licenses"
        }

def selectedBranch = SELECTED_RELEASE_BRANCH
         stage('Checkout') {
             git branch: selectedBranch, url: 'git@gitlab.com:...'
            // Remove Existing local properties
            sh 'rm local.properties ||:'
            // Write sdk.dir Path into local properties file
            sh "echo 'sdk.dir=$SDKPath' >> local.properties"
         }

         stage('Setup Tools') {
             withCredentials([file(credentialsId: 'android_keystore', variable: 'KEYFILE')]) {
                 sh "cp \$KEYFILE app/key.jks"
             }   
         }

         stage('Build Release APK') {
             sh "./gradlew clean assembleRelease"
         }

         stage('Upload to Play Store') {
            androidApkUpload googleCredentialsId: 'P12 KEY added to here', apkFilesPattern: '**/*-release.apk', trackName: 'alpha'
         }

         stage('Cleanup Credential') {
             sh "rm app/key.jks"
         }

在此處輸入圖片說明

在此處輸入圖片說明

在此處輸入圖片說明

更改路徑名ANDROID_HOME而不是HOME

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM