ArbenMaloku
ArbenMaloku

Reputation: 558

Library installed as application Android

I have two android projects, one of them I'm using as library. I've created .aar file to use it as library in project. And it's working :). But I've a problem. It installs two apps with the same name in device. Any suggestion?

Application Manifest

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
    <!--
 The ACCESS_COARSE/FINE_LOCATION permissions are not required to use
         Google Maps Android API v2, but are recommended.
    -->
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme">
        <activity
            android:name="package"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <meta-data
            android:name="com.google.android.gms.version"
            android:value="@integer/google_play_services_version" />
        <meta-data
            android:name="com.google.android.maps.v2.API_KEY"
            android:value="@string/google_maps_key" />

        <activity
            android:name="net.riinvest.riinvest.Harta"
            android:label="@string/title_activity_maps" >
        </activity>
        <activity
            android:name="package"
            android:label="@string/title_activity_kontakti" >
        </activity>
    </application>

</manifest>

Application that I use as library Manifest

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package=""
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk android:minSdkVersion="12" android:targetSdkVersion="17" />
    <uses-permission android:name="android.permission.INTERNET"/><!--For connection to server-->
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/><!--For RiProfService broadcasting-->
    <uses-permission android:name="android.permission.INTERACT_ACROSS_USERS_FULL"/>

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

    <application
        android:allowBackup="true"
        android:icon="@drawable/riiprof_logo"
        android:label="@string/app_name"

        android:theme="@style/DeviceDefault">

        <activity
            android:name=""
            android:label="@string/app_name"
            android:windowSoftInputMode="stateHidden|adjustResize"
            android:configChanges="locale|keyboardHidden|orientation|screenSize">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>   


    </application>

</manifest>

Thanks in advance. Best Regards

Upvotes: 0

Views: 717

Answers (2)

nhaarman
nhaarman

Reputation: 100388

Remove this part from your library's AndroidManifest:

        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter> 

Upvotes: 4

Shobhit Puri
Shobhit Puri

Reputation: 26007

Its showing 2 launcher icons as both your library manifest and application manifest have following:

 <intent-filter>
     <action android:name="android.intent.action.MAIN" />
     <category android:name="android.intent.category.LAUNCHER" />
  </intent-filter>

This instructs to enable the activity to be launched by a launcher icon directly. If you remove this from your library manifest. That should fix it. Hope it helps.

Upvotes: 2

Related Questions