Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"C2D_message is not unique" while trying to make sign apk

I'm trying to release an APK and while I'm trying to Generate sign APK I get this error

Error:Error: Permission name C2D_MESSAGE is not unique (appears in both com.company.myApp.permission.C2D_MESSAGE and com.company.myApp2.permission.C2D_MESSAGE) [UniquePermission]

and here is my manifest file:

<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.company.myApp">

    <permission
        android:name="com.company.myApp.permission.MAPS_RECEIVE"
        android:protectionLevel="signature" />

    <uses-feature
        android:glEsVersion="0x00020000"
        android:required="true" />

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

    <uses-permission android:name="android.permission.KILL_BACKGROUND_PROCESSES" />
    <uses-permission android:name="android.permission.WRITE_SETTINGS" />
    <uses-permission android:name="android.permission.WRITE_SECURE" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
    <uses-permission android:name="android.permission.CHANGE_CONFIGURATION" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
    <!--<uses-permission android:name="android.permission.INTERNET" />-->
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.GET_TASKS" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="com.company.myApp.permission.MAPS_RECEIVE" />
    <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
    <uses-permission android:name="android.permission.CLEAR_APP_CACHE" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

    <permission
        android:name="com.company.myApp.permission.C2D_MESSAGE"
        android:protectionLevel="signature" />

    <uses-permission android:name="com.company.myApp.permission.C2D_MESSAGE" />

    <!-- App receives GCM messages. -->
    <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
    <!-- GCM requires a Google account. -->
    <uses-permission android:name="android.permission.GET_ACCOUNTS" />
    <!-- Keeps the processor from sleeping when a message is received. -->
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />

    <application
        android:name="com.company.myApp.TruckApplication"
        android:allowBackup="true"
        android:icon="@drawable/myApp_logo"
        android:label="@string/app_name"
        android:largeHeap="true"
        android:sharedUserId="android.uid.system"
        android:theme="@style/AppTheme" >
        <uses-library android:name="com.google.android.maps" />

        <activity
            android:name="com.company.myApp.Authenticate_user_Activity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name="com.company.myApp.Login_Activity"
            android:configChanges="keyboardHidden|orientation|screenSize"
            android:screenOrientation="portrait" >
        </activity>


        <activity
            android:name="com.company.myApp.SubmitWaiver_Activity"
            android:configChanges="keyboardHidden|orientation|screenSize"
            android:screenOrientation="portrait" >
        </activity>
        <activity
            android:name="com.company.myApp.PrepStopChoice"
            android:configChanges="keyboardHidden|orientation|screenSize"
            android:screenOrientation="portrait" >
        </activity>
        <!--<activity-->
            <!--android:name="com.company.myApp.Surveyold_Activity"-->
            <!--android:configChanges="keyboardHidden|orientation|screenSize"-->
            <!--android:screenOrientation="portrait" >-->
        <!--</activity>-->
        <activity
            android:name="com.company.myApp.GetStops_Activity"
            android:configChanges="keyboardHidden|orientation|screenSize"
            android:screenOrientation="portrait" >
        </activity>
        <activity
            android:name="com.company.myApp.Load_Activity"
            android:configChanges="keyboardHidden|orientation|screenSize"
            android:screenOrientation="portrait" >
        </activity>
        <activity
            android:name="com.company.myApp.AddComment_Activity"
            android:configChanges="keyboardHidden|orientation|screenSize"
            android:screenOrientation="portrait"
            android:windowSoftInputMode="adjustResize" >
        </activity>
        <activity
            android:name="com.company.myApp.StopDetail_Activity"
            android:configChanges="keyboardHidden|orientation|screenSize"
            android:screenOrientation="portrait" >
        </activity>
        <activity
            android:name="com.company.myApp.CaptureImage_Activity"
            android:configChanges="keyboardHidden|orientation|screenSize"
            android:screenOrientation="portrait" >
        </activity>
        <activity
            android:name="com.company.myApp.Survey_Activity"
            android:configChanges="orientation|keyboardHidden|screenSize"
            android:screenOrientation="portrait" >
        </activity>
        <activity
            android:name="com.company.myApp.GetDirection_Activity"
            android:configChanges="keyboardHidden|orientation|screenSize"
            android:screenOrientation="portrait" >
        </activity>
        <activity
            android:name="com.company.myApp.Map_FragmentActivity"
            android:configChanges="keyboardHidden|orientation|screenSize"
            android:screenOrientation="portrait" >
        </activity>
        <activity
            android:name="com.company.myApp.TabBar"
            android:configChanges="keyboardHidden|orientation|screenSize"
            android:screenOrientation="portrait" >
        </activity>
        <activity
            android:name="com.company.myApp.ShowStopList_Activity"
            android:configChanges="keyboardHidden|orientation|screenSize"
            android:screenOrientation="portrait" >
        </activity>
        <activity
            android:name="com.company.myApp.PrepActivity"
            android:configChanges="keyboardHidden|orientation|screenSize"
            android:screenOrientation="landscape" >
        </activity>
        <activity
            android:name="com.company.myApp.TransprentActivity"
            android:noHistory="true"
            android:screenOrientation="portrait"
            android:theme="@android:style/Theme.Translucent.NoTitleBar"
            android:windowSoftInputMode="stateHidden|adjustPan" >
        </activity>

        <receiver
            android:name="com.google.android.gcm.GCMBroadcastReceiver"
            android:permission="com.google.android.c2dm.permission.SEND" >
            <intent-filter>
                <action android:name="com.google.android.c2dm.intent.RECEIVE" />
                <action android:name="com.google.android.c2dm.intent.REGISTRATION" />

                <category android:name="com.company.myApp" />
            </intent-filter>
        </receiver>

        <service android:name="com.myApp.Service.SyncService" >
        </service>

        <receiver android:name="com.myApp.BrodcastReciver.NetworkStateReceiver" >
            <intent-filter>
                <action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
            </intent-filter>
        </receiver>
        <receiver android:name="com.company.myApp.RepeatingAlarmService" />
        <receiver android:name="com.company.myApp.RepeatingAlaramCommunication" />
        <receiver android:name="com.company.myApp.ReaptingAlramNewStops" />

        <service android:name="com.myApp.Service.LogoutService" >
        </service>
        <service android:name="com.myApp.Service.CallNewStop_Service" >
        </service>
        <service android:name="com.myApp.Service.CheckingGooglePlayVersionService" >
        </service>

        <receiver
            android:name="com.myApp.BrodcastReciver.DateTimeChangeReceiver"
            android:enabled="true"
            android:exported="false" >
            <intent-filter>
                <action android:name="android.intent.action.DATE_CHANGED" />
            </intent-filter>
        </receiver>

        <!-- Start the Service if applicable on boot -->
        <receiver android:name="com.myApp.BrodcastReciver.PhoneReStartReceiver" >
            <intent-filter>
                <action android:name="android.intent.action.BOOT_COMPLETED" />
            </intent-filter>
        </receiver>

        <service
            android:name="com.company.myApp.TruckLocationUpdateService"
            android:enabled="true" />
        <service
            android:name="com.company.myApp.TruckCommubicationcountService"
            android:enabled="true" />
        <service android:name="com.company.myApp.GCMIntentService" />
        <service android:name="com.company.myApp.HandleNotification" />

        <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="AIzaSyB6Ae82d_eLZ1nMYIW7EaaQ3-2-Xn7duHs" />
        <!-- android:value="AIzaSyAkZzWl6FSP89yWf7VeX6ooYvd6SuRnV4E" /> -->
    </application>

    <!--<uses-permission-->
        <!--android:name="android.permission.ACCESS_MOCK_LOCATION"-->
        <!--android:required="false" />-->

    <uses-feature
        android:name="android.hardware.camera.autofocus"
        android:required="false" />

    <uses-permission
        android:name="android.permission.FLASHLIGHT"
        android:permissionGroup="android.permission-group.HARDWARE_CONTROLS"
        android:protectionLevel="normal"
        android:required="false" />
</manifest>

anyone has an idea whats wrong with this ? I have tried changing uses-permission to permission, where it had C2D_ it didn't work.

like image 207
Amir Ebrahimi Avatar asked Apr 18 '17 13:04

Amir Ebrahimi


1 Answers

You may refer with this post.

Remove

<uses-permission android:name="${applicationId}.permission.C2D_MESSAGE"/>
<permission
    android:name="${applicationId}.permission.C2D_MESSAGE"
    android:protectionLevel="signature"/>

Run App then add the permisson again and Run App.

This problem often occurs when you try to install debug and release version of your app on the same device.

like image 200
abielita Avatar answered Sep 30 '22 00:09

abielita