Resource not found using library project in Android
- by hgpc
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?