Android start activity in different java package
<p>I'm building an Android application that needs to have customer specific code. Customer specific code needs to be separated from the actual Android product our company supplies. </p>

<p>To do this I tried to create 2 packages: </p>

<ul>
<li>com.company.product.activity</li>
<li>com.company.product.customcode.activity</li>
</ul>

<p>Both packages contain ExampleActivity. 
I have written a factory that uses reflection to determine of a custom component exists on top of the product class. This works fine. </p>

<p>Using the following code to start the ExampleActivity of product works:</p>

<pre><code>    Intent intent = new Intent(this, com.company.product.activity.ExampleActivity.class);
    startActivity(intent);
</code></pre>

<p>Using the following code to start the ExampleActivity of customcode fails:</p>

<pre><code>    Intent intent = new Intent(this, com.company.product.customcode.activity.ExampleActivity.class);
    startActivity(intent);
</code></pre>

<p>Error:</p>

<pre><code>    FATAL EXCEPTION: main
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.company.product.customername/com.company.product.customcode.activity.ExampleActivity}: java.lang.IllegalArgumentException: AppIndex: The URI host must match the package name and follow the format (android-app://&lt;package_name&gt;/&lt;scheme&gt;/[host_path]). Provided URI: android-app://com.company.product.customcode.activity/http/host/path
                                                                           at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2658)
                                                                           at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2725)
</code></pre>

<p>I also tried this code, but then Android gives a Toast that it cannot find the Activity:</p>

<pre><code>    Intent intent = new Intent();
    intent.setClassName("com.company.product.customcode.activity", "com.company.product.customcode.activity.ExampleActivity");
    startActivity(intent);
</code></pre>

<p>Manifest:</p>

<pre><code>    &lt;activity android:name="com.company.product.activity.ExampleActivity"
                android:label="@string/app_name"
                android:noHistory="false"
                /&gt;

    //Custom implementation of the ExampleActivity
    &lt;activity   android:name="com.company.product.customcode.activity.ExampleActivity"
                android:label="@string/app_name"
                android:noHistory="false"
                /&gt;
</code></pre>

<p>Does anybody have any ideas or tips how to achieve the maingoal: To split custom code from the productcode where activity names might be equal.</p>