title: How to replace strings resources with Android Gradle
body: <p>I made a new app with gradle in Android Studio, and now I need to make about 10 versions with different package names and values in resources. I made custom flavors as in example and want to replace some strings in this custom flavors with custom values. I found example like this:</p>
  
  <pre><code>filter(org.apache.tools.ant.filters.ReplaceTokens, tokens: ['version': '2.2'])
  </code></pre>
  
  <p>But i don't know where to put it. As i understand i need to put it into separate task, but how to make this task called by IDE?</p>
  
  <p>Also i need to replace few variables inside Java classes and Content Provider's auth, maybe i need to do this by copy files into flavor1 folder and let gradle to merge it, but it seems like wrong solution to store many copies of files with difference in one line... Maybe i need to user some other solution for all this?</p>
  
  <p>Here is build.gradle:</p>
  
  <pre><code>buildscript {
      repositories {
          mavenCentral()
      }
      dependencies {
          classpath 'com.android.tools.build:gradle:0.4.2'
      }
  }
  apply plugin: 'android'
  
  dependencies {
      compile fileTree(dir: 'libs', include: '*.jar')
      compile project(':JazzyListView')
      compile project(':ABS')
      compile project(':Volley')
  }
  
  android {
      compileSdkVersion 17
      buildToolsVersion "17.0.0"
  
      defaultConfig {
          versionCode 5
          versionName "3.0"
          minSdkVersion 8
          targetSdkVersion 17
      }
  
      sourceSets {
          main {
              manifest.srcFile 'src/main/AndroidManifest.xml'
              java.srcDirs = ['src/main/java']
              res.srcDirs = ['src/main/res']
          }
      }
  
      productFlavors {
          flavor1 {
              packageName "com.example.flavor1"               
          }
  
          flavor2 {
              packageName "com.example.flavor2"
          }
  
      }
  
  }
  </code></pre>