title: How to start activity from another module
body: <p>I have two modules. App and module Test. Module app contains MainActivity with button. Module Test contains MainActivity two. I want to run Test/MainActivity from module app by click on button. But Android still cannot see MainActivity from module Test. See below.</p>
  
  <p>Module app Manifest:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="com.example.main"&gt;
  
  &lt;application
      android:allowBackup="true"
      android:icon="@mipmap/ic_launcher"
      android:label="@string/app_name"
      android:roundIcon="@mipmap/ic_launcher_round"
      android:supportsRtl="true"
      android:theme="@style/AppTheme"&gt;
  
      &lt;activity android:name=".MainActivity"&gt;
          &lt;intent-filter&gt;
              &lt;action android:name="android.intent.action.MAIN" /&gt;
              &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
          &lt;/intent-filter&gt;
      &lt;/activity&gt;
  
      &lt;activity android:name="com.example.test.MainActivity"&gt;
          &lt;intent-filter&gt;
              &lt;action android:name="android.intent.action.MAIN" /&gt;
              &lt;category android:name="android.intent.category.DEFAULT" /&gt;
          &lt;/intent-filter&gt;
      &lt;/activity&gt;
  &lt;/application&gt;
  </code></pre>
  
  <p></p>
  
  <p>Module Test manifest:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="com.example.test"&gt;
  
  &lt;application
      android:allowBackup="true"
      android:icon="@mipmap/ic_launcher"
      android:label="@string/app_name"
      android:roundIcon="@mipmap/ic_launcher_round"
      android:supportsRtl="true"
      android:theme="@style/AppTheme"&gt;
      &lt;activity android:name=".MainActivity"&gt;
          &lt;intent-filter&gt;
              &lt;action android:name="android.intent.action.MAIN" /&gt;
  
              &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
          &lt;/intent-filter&gt;
      &lt;/activity&gt;
  &lt;/application&gt;
  </code></pre>
  
  <p></p>
  
  <p>Code in Module app MainActivity for click button and run second Activity:</p>
  
  <pre><code> public void runActivity(View view) {
  
      Intent intent = null;
      try {
          intent = new Intent(this, Class.forName("com.example.test.MainActivity"));
          startActivity(intent);
      } catch (Exception e) {
          e.printStackTrace();
      }
  }
  </code></pre>
  
  <p>In Console I get an error:</p>
  
  <blockquote>
    <p>W/System.err: java.lang.ClassNotFoundException:
    com.example.test.MainActivity</p>
  </blockquote>
  
  <p><strong>EDIT:</strong>
  In app build.gradle file I have:</p>
  
  <pre><code>implementation project(path:':test', configuration:'default')
  </code></pre>
  
  <p><strong>EDIT 2:</strong>
  Here is <a href="http://data.soft4you.cz/MyApplication.zip" rel="nofollow noreferrer">link</a> with complete example that not working.</p>