0

My application in Android Studio has separate components for mobile devices and for Google Glasses. When I attempt to load the mobile version onto a Nexus 10 (Android version 4.4.2) I get the following error:

Applications have the same package name com.example.carterpedersen.datatransfer:
mobile, glass

I can, however, load the app onto a glass device (XE19.1) with no problem.

I find this error perplexing because my app has been running with no problem for several weeks, and all of a sudden the mobile component is crippled. I did recently add a dependency on the glass R to the mobile component, but even this was a few days before this error showed itself.

I tried refactoring the mobile directory, as well as the whole package, with no success.

I have searched SO and other sources but I didn't find any duplicates; please link me if I am wrong on this point. Thanks for the help. Provided manifests are below.

Mobile manifest:

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

<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >

    <activity
        android:name="com.example.carterpedersen.datatransfer.FileRetrieval"
        android:label="@string/app_name" >
    </activity>

    <activity
        android:name="com.example.carterpedersen.datatransfer.BluetoothClient"
        android:label="@string/title_activity_bluetooth_client" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

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

</application>

Glass Manifest:

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

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name="com.example.carterpedersen.datatransfer.LauncherActivity"
        android:label="@string/title_activity_launcher" >
    </activity>
    <activity
        android:name="com.example.carterpedersen.datatransfer.LiveCardMenuActivity"
        android:theme="@style/MenuTheme" >
    </activity>

    <!-- Service responsible for maintaining LiveCard -->
    <service
        android:name="com.example.carterpedersen.datatransfer.LiveCardDataCollect"
        android:icon="@drawable/ic_glass_logo"
        android:label="@string/title_activity_live_card_data_collect" >
        <intent-filter>
            <action android:name="com.google.android.glass.action.VOICE_TRIGGER" />
        </intent-filter>

        <meta-data
            android:name="com.google.android.glass.VoiceTrigger"
            android:resource="@xml/voice_trigger" />
    </service>

    <!-- For content sharing permissions -->
    <provider
        android:name="android.support.v4.content.FileProvider"
        android:authorities="com.example.carterpedersen.datatransfer.fileprovider"
        android:exported="false"
        android:grantUriPermissions="true" >
        <meta-data
            android:name="android.support.FILE_PROVIDER_PATHS"
            android:resource="@xml/file_paths" />
    </provider>

    <!-- Selects file for sharing to client. -->
    <activity
        android:name="com.example.carterpedersen.datatransfer.FileShareActivity"
        android:label="@string/title_activity_file_share" >
        <intent-filter>
            <action android:name="android.intent.action.PICK" />

            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.OPENABLE" />

            <data android:mimeType="*/*" />
        </intent-filter>
    </activity>

    <activity
        android:name="com.example.carterpedersen.datatransfer.BluetoothHost"
        android:label="@string/title_activity_bluetooth_host" >
    </activity>

    <receiver android:name="com.example.carterpedersen.datatransfer.BluetoothHost$HostBroadRec" >
        <intent-filter>
            <action android:name="transapps.g6.new.alert" />
        </intent-filter>
    </receiver>

</application>

Carter
  • 1
  • 3

3 Answers3

0

Try using just one manifest (combined for use on both mobile and Glass - I'm assuming one apk correct?)

dljava
  • 1,825
  • 17
  • 14
0

Just close completely the android studio and reopen it. My problem solved after this.

By the way you can try this command on cmd:

adb uninstall com.your.package
Arda Ç.
  • 504
  • 5
  • 7
-1

Try changing the package name in each of the AndroidManifest.xml files. So, for example, change to:

Mobile

<manifest 
    xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.carterpedersen.mobile.datatransfer" >

Glass

<manifest 
    xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.carterpedersen.glass.datatransfer" >

The package name should be unique amongst applications. Refer to the package attribute definition.

CJBS
  • 15,147
  • 6
  • 86
  • 135