title: Product Variants: Multiple Activities
body: <p>I'm using Product Variants in gradle/android studio to achieve the following project setup:</p>
  
  <ol>
  <li>Two apps, that are 80% similar in one android studio project.</li>
  <li>Each app should have its own manifest package path (they should basically behave like two independent apps - with it's own google api and push keys)</li>
  </ol>
  
  <p>I've followed multiple tutorials in my attempt to achieve this (placeholders, multiple manifests) but nothing works.</p>
  
  <p>Following this tutorial I did the following:
  <a href="http://www.kevinrschultz.com/blog/2014/03/23/using-android-content-providers-with-multiple-package-names/">http://www.kevinrschultz.com/blog/2014/03/23/using-android-content-providers-with-multiple-package-names/</a></p>
  
  <p>My build.gradle:</p>
  
  <pre><code>android {
  compileSdkVersion 19
  buildToolsVersion '20'
  
  defaultConfig {
      minSdkVersion 10
      targetSdkVersion 19
      versionCode 1
      versionName "1.0"
  }
  
  buildTypes {
      release {
          runProguard false
          proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
      }
  }
  
  productFlavors {
      app1 {
          packageName "com.test.app1"
          //applicationId "com.test.app1"
      }
  
      app2 {
          packageName "com.test.app2"
          //applicationId "com.test.app2"
      }
  }}
  </code></pre>
  
  <p>And here my manifest files.</p>
  
  <p>src/main/manifest:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  </code></pre>
  
  <p></p>
  
  <pre><code>&lt;application&gt;
  &lt;/application&gt;
  </code></pre>
  
  <p></p>
  
  <p>src/app1/manifest:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"&gt;
      &lt;uses-permission android:name="android.permission.INTERNET" /&gt;
      &lt;application
          android:name="com.test.app1”
          android:allowBackup="true"
          android:icon="@drawable/ic_launcher"
          android:label="@string/app_name"
          android:theme="@style/AppTheme" &gt;
  
          &lt;activity
              android:name="com.test.app1.MainActivity"
              android:label="@string/app_name"
              android:launchMode="singleTask"
              android:screenOrientation="portrait" &gt;
          &lt;/activity&gt;
      &lt;/application&gt;
  &lt;/manifest&gt;
  </code></pre>
  
  <p>src/app2/manifest:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"&gt;
      &lt;uses-permission android:name="android.permission.INTERNET" /&gt;
      &lt;application
          android:name="com.test.app2”
          android:allowBackup="true"
          android:icon="@drawable/ic_launcher"
          android:label="@string/app_name"
          android:theme="@style/AppTheme" &gt;
  
          &lt;activity
              android:name="com.test.app2.MainActivity"
              android:label="@string/app_name"
              android:launchMode="singleTask"
              android:screenOrientation="portrait" &gt;
          &lt;/activity&gt;
      &lt;/application&gt;
  &lt;/manifest&gt;
  </code></pre>
  
  <p>This gives me the following error message:</p>
  
  <pre><code>Manifest merger failed : Main AndroidManifest.xml at AndroidManifest.xml manifest:package attribute is not declared
  </code></pre>
  
  <p>Unfortunately I can't set a package to each individual manifest tag as my app requires different package paths. If I do it anyway, the merger is not able to merge the manifest files because of different package values. Besides packageName I also tried setting "applicationId" but this doesn't work, either. Using a placeholder like this <code>package="${applicationId}"</code> doesn't work because it doesn't resolve the variable value.</p>
  
  <p>Any ideas how to solve this problem? I'm using Android Studio 0.8.2 with gradle 0.12.2</p>