Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I want to run a shell script to change the value in string.xml when my app is built. Where should I run my script in gradle, since there is no task in it. Or, because I will build the app use Jenkins, should I run the script on Jenkins server? Please help me out.

    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 {...}
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
454 views
Welcome To Ask or Share your Answers For Others

1 Answer

You can add a preBuild step that runs the script and makes it depend on build.

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...