title: ProductFlavors Configuration
body: <p>I configured a constant in the build.gradle of the application I developed.
  It is an "End-Point" constant for API calls.
  When I'm developing in the development environment, the application calls an "End-Point", when I'm developing in the production environment the application calls another "End-Point".
  Now comes the problem, when I'm developing the tests for the application, the configuration is not working to pick up the End-Point Correctly.
  Can someone help me?</p>
  
  <pre><code>buildTypes {
      release {
          minifyEnabled false
          proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
          buildConfigField STRING, API_URL, '"https://end-point-production/"'
      }
      debug {
          buildConfigField STRING, API_URL, '"https://end-point-dev/"'
      }
  }
  
  productFlavors {
      ui_tests {
          buildConfigField STRING, API_URL, '"http://end-point-tests/"'
      }
  }
  
  public class BaseController {
  
  // Service url.
  protected static final String API_URL = BuildConfig.API_URL;
  
  /**
   * Crates a basic retrofit request.
   *
   * @return Retrofit request.
   */
  public static Retrofit getRetrofit() {
      OkHttpClient client = new OkHttpClient();
      client.setConnectTimeout(5, TimeUnit.SECONDS);
      client.setReadTimeout(15, TimeUnit.SECONDS);
      client.setWriteTimeout(5, TimeUnit.SECONDS);
  
      return new Retrofit.Builder()
              .baseUrl(API_URL)
              .client(client)
              .addConverterFactory(GsonConverterFactory.create(new GsonBuilder()
                      .excludeFieldsWithoutExposeAnnotation()
                      .create()))
              .build();
      }
   }
  
  
  @Before
  public void setUp() throws Exception {
      server = new MockWebServer();
      server.start(8681);
  
      OkHttpClient client = new OkHttpClient();
      client.setConnectTimeout(5, TimeUnit.SECONDS);
      client.setReadTimeout(15, TimeUnit.SECONDS);
      client.setWriteTimeout(5, TimeUnit.SECONDS);
  
      new Retrofit.Builder()
              .baseUrl(API_URL)
              .client(client)
              .addConverterFactory(GsonConverterFactory.create(new GsonBuilder()
                      .excludeFieldsWithoutExposeAnnotation()
                      .create()))
              .build();
  }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/LeHsi.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/LeHsi.png" alt="UiTests Environment"></a></p>