Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing "exported" attributed in manifest while generating APK #143

Closed
AntonioTangeloGames opened this issue Jan 13, 2022 · 5 comments
Closed

Comments

@AntonioTangeloGames
Copy link

AntonioTangeloGames commented Jan 13, 2022

After the Behavior changes in Android, If your app targets Android 12 or higher and contains activities, services, or broadcast receivers that use intent filters, you must explicitly declare the "android: exported" attribute for these app components.

This is not happening right now, failing when the apk is uploaded to android. This attribute should be added into the manifest when it is generated in the class "AndroidNotificationPostProcessor" line 118 approx.

https://developer.android.com/about/versions/12/behavior-changes-12#exported

Is happening in Android, Unity 2020.3.20f, "Mobile notification package" version 1.4.2 ( the last when this was written )

@AntonioTangeloGames AntonioTangeloGames changed the title Missing "exported" atributed in manifest after generate apk Missing "exported" attributed in manifest while generating APK Jan 13, 2022
@vitordealmeida
Copy link

Can confirm the issue, I'm receiving a warning that my game will not be downloadable by Android 12 users. The receiver that presented the problem is com.unity.androidnotifications.UnityNotificationRestartOnBootReceiver. My solution was to provide a customized AndroidManifest in my unity project to avoid this issue with the following content:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.unity3d.player"
          android:installLocation="preferExternal" android:versionCode="1" android:versionName="1.0">
    <supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true"
                      android:xlargeScreens="true" android:anyDensity="true"/>
    <application android:theme="@android:style/Theme.NoTitleBar.Fullscreen" android:icon="@drawable/app_icon"
                 android:label="@string/app_name">
        <activity android:name="com.unity3d.player.UnityPlayerActivity" android:label="@string/app_name"
                  android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
            <meta-data android:name="unityplayer.UnityActivity" android:value="true"/>
        </activity>

        <receiver
                android:name="com.unity.androidnotifications.UnityNotificationManager"
                android:exported="true" />
        <receiver
                android:name="com.unity.androidnotifications.UnityNotificationRestartOnBootReceiver"
                android:exported="true"
                android:enabled="false">
            <intent-filter>
                <action android:name="android.intent.action.BOOT_COMPLETED" />
            </intent-filter>
        </receiver>
    </application>
</manifest>

@AntonioTangeloGames
Copy link
Author

AntonioTangeloGames commented Jan 13, 2022

Thanks! it should work.
We have a custom manifest as well, but we don't have on it the receiver for mobile notification.
We could add it and fix the issue, but I think that this is something that the package should provide to us.

@vitordealmeida
Copy link

Agreed, just shared a quick workaround that worked for us

@dcosmin-97
Copy link

The issue is solved in 1.5.0, but the tag is not modified yet to 1.5.0 so you cannot update yet, maybe they forgot to add it

@aurimasc
Copy link
Collaborator

This issue is fixed in master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants