title: Launch activity that resides in a separate library (Android)
body: <p>I'm trying to start an Activity from an application that resides in an android library. I keep getting the following exception when I try to start the activity from application.</p>
  
  <pre><code>09-07 12:26:35.300: E/AndroidRuntime(553): FATAL EXCEPTION: main
  09-07 12:26:35.300: E/AndroidRuntime(553): java.lang.IllegalStateException: Could not execute method of the activity
  09-07 12:26:35.300: E/AndroidRuntime(553):  at android.view.View$1.onClick(View.java:3044)
  09-07 12:26:35.300: E/AndroidRuntime(553):  at android.view.View.performClick(View.java:3511)
  09-07 12:26:35.300: E/AndroidRuntime(553):  at android.view.View$PerformClick.run(View.java:14105)
  09-07 12:26:35.300: E/AndroidRuntime(553):  at android.os.Handler.handleCallback(Handler.java:605)
  09-07 12:26:35.300: E/AndroidRuntime(553):  at android.os.Handler.dispatchMessage(Handler.java:92)
  09-07 12:26:35.300: E/AndroidRuntime(553):  at android.os.Looper.loop(Looper.java:137)
  09-07 12:26:35.300: E/AndroidRuntime(553):  at android.app.ActivityThread.main(ActivityThread.java:4424)
  09-07 12:26:35.300: E/AndroidRuntime(553):  at java.lang.reflect.Method.invokeNative(Native Method)
  09-07 12:26:35.300: E/AndroidRuntime(553):  at java.lang.reflect.Method.invoke(Method.java:511)
  09-07 12:26:35.300: E/AndroidRuntime(553):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
  09-07 12:26:35.300: E/AndroidRuntime(553):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
  09-07 12:26:35.300: E/AndroidRuntime(553):  at dalvik.system.NativeStart.main(Native Method)
  09-07 12:26:35.300: E/AndroidRuntime(553): Caused by: java.lang.reflect.InvocationTargetException
  09-07 12:26:35.300: E/AndroidRuntime(553):  at java.lang.reflect.Method.invokeNative(Native Method)
  09-07 12:26:35.300: E/AndroidRuntime(553):  at java.lang.reflect.Method.invoke(Method.java:511)
  09-07 12:26:35.300: E/AndroidRuntime(553):  at android.view.View$1.onClick(View.java:3039)
  09-07 12:26:35.300: E/AndroidRuntime(553):  ... 11 more
  09-07 12:26:35.300: E/AndroidRuntime(553): Caused by: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=com.smarttech.androidlibrary.LibraryActivity.LAUNCH }
  09-07 12:26:35.300: E/AndroidRuntime(553):  at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1512)
  09-07 12:26:35.300: E/AndroidRuntime(553):  at android.app.Instrumentation.execStartActivity(Instrumentation.java:1384)
  09-07 12:26:35.300: E/AndroidRuntime(553):  at android.app.Activity.startActivityForResult(Activity.java:3190)
  09-07 12:26:35.300: E/AndroidRuntime(553):  at android.app.Activity.startActivity(Activity.java:3297)
  09-07 12:26:35.300: E/AndroidRuntime(553):  at com.smarttech.application.MainActivity.buttonLaunchActivity(MainActivity.java:25)
  09-07 12:26:35.300: E/AndroidRuntime(553):  ... 14 more
  </code></pre>
  
  <p>I'm working in Eclipse, and I have created two projects - application and library.</p>
  
  <p>Library is declared as an Android Library through Properties->Android->Is Library<br>
  Application references the library through Properties->Android->Add.</p>
  
  <p>I followed the instructions for <a href="http://developer.android.com/tools/projects/projects-eclipse.html" rel="nofollow">Managing Projects from Eclipse with ADT</a>.</p>
  
  <p>LIBRARY:</p>
  
  <pre><code>&lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.smarttech.androidlibrary"
      android:versionCode="1"
      android:versionName="1.0" &gt;
  
      &lt;uses-sdk
          android:minSdkVersion="15"
          android:targetSdkVersion="15" /&gt;
  
      &lt;application
          android:icon="@drawable/ic_launcher"
          android:label="@string/app_name"
          android:theme="@style/AppTheme" &gt;
          &lt;activity
              android:name=".LibraryActivity"
              android:label="@string/title_activity_main" &gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="com.smarttech.androidlibrary.LibraryActivity.LAUNCH" /&gt;
              &lt;/intent-filter&gt;
          &lt;/activity&gt;
      &lt;/application&gt;  
  &lt;/manifest&gt;
  </code></pre>
  
  <p>APPLICATION:</p>
  
  <pre><code>&lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.smarttech.application"
      android:versionCode="1"
      android:versionName="1.0" &gt;
  
      &lt;uses-sdk
          android:minSdkVersion="15"
          android:targetSdkVersion="15" /&gt;
  
  
      &lt;application
          android:icon="@drawable/ic_launcher"
          android:label="@string/app_name"
          android:theme="@style/AppTheme" &gt;
          &lt;activity
              android:name=".MainActivity"
              android:label="@string/title_activity_main" &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.smarttech.androidlibrary.LibraryActivity"&gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="com.smarttech.androidlibrary.LibraryActivity.LAUNCH"/&gt;
              &lt;/intent-filter&gt;
          &lt;/activity&gt;
      &lt;/application&gt;
  
  &lt;/manifest&gt;
  </code></pre>
  
  <p>--</p>
  
  <pre><code>package com.smarttech.application;
  
  import android.app.Activity;
  import android.content.Intent;
  import android.os.Bundle;
  import android.view.Menu;
  import android.view.View;
  
  public class MainActivity extends Activity {
  
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
      }
  
      @Override
      public boolean onCreateOptionsMenu(Menu menu) {
          getMenuInflater().inflate(R.menu.activity_main, menu);
          return true;
      }
  
      public void buttonLaunchActivity(View view) {
          Intent i = new Intent("com.smarttech.androidlibrary.LibraryActivity.LAUNCH");
          startActivity(i);
      }
  
  }
  </code></pre>