android library project manifest file

user1013062 picture user1013062 · Dec 18, 2011 · Viewed 8k times · Source

I am trying to integrate a todo app which is open source into my main app. I have made the todo app as a library project and integrated the manifest.xml as informed in the manual...but I am facing one issue.

In my library project manifest file it start with

<application android:name=".TodoApplication" android:icon="@drawable/todotxt_touch_icon" >

How can I integrate this into my main manifest file because I already have an application name...I have integrated activities of the library project but I am unable to integrate this line and it is not working because of that....

Please find manifest.xml of the library project:

    <?xml version="1.0" encoding="utf-8"?>

<manifest package="com.todotxt.todotxttouch"
    android:versionName="0.7" android:versionCode="21"
    xmlns:android="http://schemas.android.com/apk/res/android">
    <!-- Warning 'is lower than the project target API level' should be ok -->

    <uses-sdk android:minSdkVersion="3" android:targetSdkVersion="4" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

    <application android:name=".TodoApplication" android:icon="@drawable/todotxt_touch_icon"
        android:label="@string/app_label" android:debuggable="true">

        <uses-configuration></uses-configuration>
        <supports-screens android:largeScreens="true"
            android:normalScreens="true" android:smallScreens="true"
            android:resizeable="true" android:anyDensity="true" />

        <activity android:name=".LoginScreen" android:label="@string/app_label"
            android:theme="@android:style/Theme.NoTitleBar"
            android:configChanges="keyboardHidden|orientation">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <activity android:name=".Filter" android:label="Filter"
            android:theme="@android:style/Theme.NoTitleBar" />
        <activity android:name=".Preferences" android:label="@string/set_preferences" />
        <activity android:name=".AddTask" android:label="@string/addtask"
            android:theme="@android:style/Theme.NoTitleBar"
            android:configChanges="orientation|keyboardHidden"
            android:windowSoftInputMode="adjustResize">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
            </intent-filter>
        </activity>

        <activity-alias android:name=".AddTaskShortcut"
            android:targetActivity=".AddTask" android:label="@string/shortcut_addtask_name">
            <intent-filter>
                <action android:name="android.intent.action.CREATE_SHORTCUT" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity-alias>
        <activity-alias android:name=".AddTaskShare"
            android:targetActivity=".AddTask" android:label="@string/share_addtask_name">
            <intent-filter>
                <action android:name="android.intent.action.SEND" />
                <category android:name="android.intent.category.DEFAULT" />
                <data android:mimeType="text/plain" />
            </intent-filter>
        </activity-alias>
        <activity android:name=".HelpActivity"
            android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" />
        <activity android:name=".TodoTxtTouch" android:theme="@android:style/Theme.NoTitleBar"
            android:configChanges="keyboardHidden|orientation">
            <intent-filter>
                <action android:name="android.intent.action.SEARCH" />
            </intent-filter>
            <meta-data android:name="android.app.searchable"
                android:resource="@xml/searchable" />
        </activity>

        <!-- Task list widget -->
        <receiver android:name=".TodoWidgetProvider" android:label="@string/app_label">
            <intent-filter>
                <action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
            </intent-filter>
            <intent-filter>
                <action android:name="com.todotxt.todotxttouch.APPWIDGET_UPDATE"/>
            </intent-filter>
            <meta-data android:name="android.appwidget.provider" android:resource="@xml/todo_widget_provider" />
        </receiver>

    </application>

    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"></uses-permission>

</manifest> 

The main part where I am stuck is with the application name part....how can I integrate the library project application name in my main app manifest because it already has a application name...so I am getting stuck in that part and it is not working because of that only as it throws run time error....

I have integrated all activities of my library project with their full package name in my main app manifest files. anyone can guide me where I am going wrong...

Answer

Entreco picture Entreco · Dec 18, 2011

From what I know, integrating a library project doesn't require to change your manifest. Just create your own project, and open the project you want to include in a seperate project.

In Eclilpse, you can right click your project, go to properites, and check: Library-project. In your own project, you must go to the build properties, and in the project-tab add your Todo Application there. This way, the Todo app is build when you build your own app as well.

EDIT (based on comments) : You can declare the activities that you want to use in your manifest. The Application name, is not required in your Manifest.