Resource not found using library project in Android

Posted by hgpc on Stack Overflow See other posts from Stack Overflow or by hgpc
Published on 2010-05-23T14:08:09Z Indexed on 2010/05/23 14:10 UTC
Read the original article Hit count: 891

Filed under:
|
|

I'm converting an existing project into a library project. I configured the original project as a library project and added an application project which references the original project as a library.

The library project has an activity (MainActivity) and its layout (main.xml). The application project declares this activity as the main activity in the manifest like this:

<activity android:name="com.example.MainActivity"
    android:label="@string/app_name">
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
</activity>

When I run the application project I get the following error...

android.content.res.Resources$NotFoundException: Resource ID #0x7f030002

...on the following line of the onCreate method of the main activity:

setContentView(R.layout.main);

0x7f030002 is the ID of R.layout.main in the library project. The application project has no main resource.

If I run the original project I don't get this error. Both projects neither have compilation errors nor warnings and are built with Android 2.2 with min SDK version 3.

What might be the problem?

© Stack Overflow or respective owner

Related posts about android

Related posts about library