簡體   English   中英

在Android Gradle中執行Shell腳本

[英]Execute shell script in android gradle

我想運行一個Shell腳本來在構建我的應用程序時更改string.xml中的值。 我應該在哪里在gradle中運行腳本,因為其中沒有任務。 或者,因為我將使用Jenkins構建應用程序,所以我應該在Jenkins服務器上運行腳本嗎? 請幫幫我。

    apply plugin: 'com.android.application'

 android {
     compileSdkVersion 22
     buildToolsVersion '22.0.1'
     }

defaultConfig {
   .......
     }

buildTypes {
    release {
      .......
       }
     }

productFlavors {
    development {}
    production {}
     }

sourceSets {
    androidTest {
        setRoot('src/test')
              }
     }

packagingOptions {..}


dependencies {...}

您可以添加一個preBuild步驟來運行腳本並使它依賴於構建。

task myPreBuild << {
   commandLine './script.sh'
}
build.dependsOn myPreBuild

暫無
暫無

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

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