title: Android: Launching Library Activity from Main App
body: <p>i already readed the "similar questions" but i'm still not able to launch the Library Project Activity from the Main Project.</p>
  
  <p>I have project A (Main)
  and i have project B (library)</p>
  
  <p>Activity is declared in the library manifest (even in main manifest)</p>
  
  <p>but when i run the code the log throws the error that ask if activity is declared in manifest.xml file.</p>
  
  <p>Main Project is rightly including the library, everything compiles but the error is that, i put the intent i'm trying from main project:</p>
  
  <pre><code>Intent intent = new Intent();
  intent.setComponent(new ComponentName("com.package.activities", "MyActivity"));
  intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
  intent.setPackage(context.getPackageName()); // tried without this
  context.startActivity(intent);
  </code></pre>
  
  <p>this is my manifest (from library project):</p>
  
  <pre><code>&lt;activity
          android:name="com.package.activities.MyActivity"
          android:exported="true"
          android:label="@string/title_activity"
          android:screenOrientation="landscape"
          android:configChanges="keyboardHidden|orientation"/&gt;
  </code></pre>
  
  <p>Log: </p>
  
  <blockquote>
    <p>android.content.ActivityNotFoundException: Unable to find explicit activity class {com.package.activities/MyActivity}; have you declared this activity in your AndroidManifest.xml?</p>
  </blockquote>