Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice

Question Not able to publish on Google Play / android:exported / Android 12

Discussion in 'Android' started by MariusAAnghel00, Jan 14, 2022.

  1. MariusAAnghel00

    MariusAAnghel00

    Joined:
    Jan 18, 2021
    Posts:
    8
    Hello all,

    I reaslied today that I can't update my game anymore. The error I get is: "You uploaded an APK or Android App Bundle which has an activity, activity alias, service or broadcast receiver with intent filter, but without 'android:exported' property set. This file can't be installed on Android 12 or higher. See: developer.android.com/about/versions/12/behavior-changes-12#exported"


    upload_2022-1-14_16-54-46.png



    What I've tried already:

    - Updated Unity version to 2020.3.25.f1 - same error
    - With 2020.3.25.f1 and 2019.4.28f1 -> I've selected "Custom Main Manifest" (Project Settings > Player > Android > Publishing Settings > Build), and added android:exported="false" (one time) and android:exported="true" (another time) in AndroidManifest.xml --> but still same error


    Does anyone know any other method that will fix the error and allow me to update the game? I have Target API Level: 32.


    Thank you!!
     
  2. Voxel-Busters

    Voxel-Busters

    Joined:
    Feb 25, 2015
    Posts:
    1,961
    We shared a solution to add automatically the exported flag in-case if you can't update your unity version.
    Have a look here.
     
  3. imbruceter

    imbruceter

    Joined:
    May 20, 2020
    Posts:
    9
    I tested your method but it didn't solve the problem.
     
  4. Voxel-Busters

    Voxel-Busters

    Joined:
    Feb 25, 2015
    Posts:
    1,961
    Send me a dummy apk (with all scenes removed from the build settings) to have a look.
    Most likely you may have other plugins which needs to add exported flag to manifest.
     
  5. imbruceter

    imbruceter

    Joined:
    May 20, 2020
    Posts:
    9
    Thank you for your reply! I have sent an e-mail onto support@voxelbusters.com with an explanation and with the dummy apk you asked for (didn't want to share it through here).
     
  6. Voxel-Busters

    Voxel-Busters

    Joined:
    Feb 25, 2015
    Posts:
    1,961
    Send me a dm here instead :)
     
  7. imbruceter

    imbruceter

    Joined:
    May 20, 2020
    Posts:
    9
    So, the issue is that Google doesn't let publishing an app bundle because of this android:exported flag.

    What I've made so far:
    Made a Custon Main Manifest and added android:exported="true" inside the <activity>.
    I've also updated my Unity to the latest version.
    I "implemented" your script (it's inside the Editor subforlder).

    I have a NativeShare plugin as well. I have no idea how to add the exported flag onto this plugin and I'm not even sure if that's causing the issue.
    However, I found out that everytime I am building an apk or an app bundle, an AndroidManifest.xml get's created which has it's android:exported set to false (see in the screenshot I've attached).
    Could it be, that I have to set each or one of these to true instead? Which ones?
    And most importantly: how? Do I have to copy this and make a Custom Gradle Temlate and then copy all this inside with setting these exported flags to true? If yes, which one of the Gradle Templades do I have to create? There's a bunch of options for that inside Unitys Player Settings > Publishing Settings > Build.

    I have sent the apk in DM.
     
  8. JuliusM

    JuliusM

    Unity Technologies

    Joined:
    Apr 17, 2013
    Posts:
    835
    Try to create a new empty project, build it and see if the issue is reproducible. If it is not reproducible, add the NativeShare plugin and see if the issue becomes reproducible. Most likely that plugin adds its own activity, activity alias, service or broadcast receiver with intent filter which does not specify android:exported property. You will have to look for a new plugin version which has this fixed.
    I expect this issue will be caused by the plugin, because you use Unity 2020.3.25.f1 which already adds android:exported property for Unity activity.

    android:exported property is specified for Unity activity starting with these versions: 2019.4.33f1, 2020.3.22f1, 2021.1.20f1 and 2021.2.0b11.
     
    niirirgomel likes this.
  9. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,704
    When I create a new custom main manifest in 2020.3.26f1 (and I believe also 2021.2.8f1) the generated AndroidManifest.xml does not contain the android:exported property.

    Shouldn't it?
     
  10. imbruceter

    imbruceter

    Joined:
    May 20, 2020
    Posts:
    9
    Well, the NativeShare is causing the issue, I'm pretty sure. It has it's android:exported set to false. I tried to override it with a Custom Main Mainfest (copy-pasted and changed from false to true) but that is somehow not merging.
    Isn't there any other solution than removing this plugin? Can't I somehow set it to true instead of implementing a whole another plugin?
    If it's necesseraly, can you suggest me any other, which has been already updated?
     
    Last edited: Jan 18, 2022
  11. Voxel-Busters

    Voxel-Busters

    Joined:
    Feb 25, 2015
    Posts:
    1,961
    Thanks for sharing the empty apk to look into.
    Your project has mobile notifications plugin which is adding the below entry in the manifest.
    Code (CSharp):
    1.         <receiver android:name="com.unity.androidnotifications.UnityNotificationRestartOnBootReceiver" android:enabled="false">
    2.             <intent-filter>
    3.                 <action android:name="android.intent.action.BOOT_COMPLETED"/>
    4.             </intent-filter>
    5.         </receiver>
    Solution is mentioned over here and listing the same below.
    As per Android 12,
    So either you need to grab a latest version of that plugin (if they fix it) or delete it if you don't use it.
     
    Pratyushs_unity, xxluky and cdr9042 like this.
  12. imbruceter

    imbruceter

    Joined:
    May 20, 2020
    Posts:
    9
    Thank you so-so much for helping me with that!
    I have never thought, not even for a second that Unitys "dedicated" package is going to cause this issue...
    I deleted it and all the referred codes, now it works. I also found an asset in the store which has an update for Android 12, implementing that.

    Thank you again, you literally saved me there!
     
    Voxel-Busters likes this.
  13. JuliusM

    JuliusM

    Unity Technologies

    Joined:
    Apr 17, 2013
    Posts:
    835
    No, it gets added during the build, so the manifest template in Unity project's Plugins/Android will not have it, but the manifest in the exported gradle project (or built app) will have it.
     
  14. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,704
    Seems a bit counter-intuitive to me (but I guess this way it gets fixed even in projects that already use a custom manifest).

    Thanks for clearing that up.
     
    Last edited: Jan 19, 2022
  15. razvanbugneriu

    razvanbugneriu

    Joined:
    Feb 17, 2018
    Posts:
    4
    Hello!
    I got the same error: "You uploaded an APK or Android App Bundle which has an activity, activity alias, service or broadcast receiver with intent filter, but without 'android:exported' property set. This file can't be installed on Android 12 or higher. See: developer.android.com/about/versions/12/behavior-changes-12#exported".
    But I don't have the mobile notifications plugin installed.
     
  16. Voxel-Busters

    Voxel-Busters

    Joined:
    Feb 25, 2015
    Posts:
    1,961
    Share me an empty apk to look into.
     
  17. Voxel-Busters

    Voxel-Busters

    Joined:
    Feb 25, 2015
    Posts:
    1,961
    @razvanbugneriu I checked the apk you sent me on a DM and sent you the reason. Contact the publisher of that plugin to get an updated version.
     
  18. HotYearKit

    HotYearKit

    Joined:
    Dec 4, 2018
    Posts:
    13
    test use target 31. 32 not Stable
     
    Last edited: Jan 24, 2022
  19. Voxel-Busters

    Voxel-Busters

    Joined:
    Feb 25, 2015
    Posts:
    1,961
    What do you mean?
     
  20. TienBro

    TienBro

    Joined:
    Nov 23, 2015
    Posts:
    5
  21. Karan1104

    Karan1104

    Joined:
    Jan 25, 2022
    Posts:
    1
    bro i have made app in i am facing the same issue after adding export property in activity the error doest not resolves and while uploading the bundle is shows the same issue on android 12 and says to add export property. please help me. thank you !!!!!
     
  22. Voxel-Busters

    Voxel-Busters

    Joined:
    Feb 25, 2015
    Posts:
    1,961
    For those who are still facing the issue even after trying the shared script above, share the manifest file in the attached screenshot path or an empty apk file too look into.

    Screenshot 2022-01-24 at 2.59.15 PM.png
     
  23. razvanbugneriu

    razvanbugneriu

    Joined:
    Feb 17, 2018
    Posts:
    4
    Thanks a lot!
    It worked!
     
    Voxel-Busters likes this.
  24. ahmedaniss

    ahmedaniss

    Joined:
    Sep 18, 2019
    Posts:
    98
    Problem Fixed here :
     
    Last edited: Jan 30, 2022
  25. Ghazi-Murad

    Ghazi-Murad

    Joined:
    Jun 29, 2015
    Posts:
    1
    have an AndroidManifest.xml under plugins>Android. Add this in manifest, save and build. I fixed this error with that.
    upload_2022-1-30_0-17-10.png upload_2022-1-30_0-18-10.png
     
  26. ahmedaniss

    ahmedaniss

    Joined:
    Sep 18, 2019
    Posts:
    98
    Fixed here :
     
    IAmChiagozie and AlexMiu028 like this.
  27. ahmedaniss

    ahmedaniss

    Joined:
    Sep 18, 2019
    Posts:
    98
  28. lasdoo5

    lasdoo5

    Joined:
    May 18, 2018
    Posts:
    16
    This worked for me

     
  29. IAmChiagozie

    IAmChiagozie

    Joined:
    Jun 26, 2017
    Posts:
    37
    This worked for me and I successfuly uploaded to google play. I didn't follow the exact steps because of a third party SDK I am using... but I added this line inside <application>
    <activity android:name="com.something.somethng1.something2" android:exported="true"></activity>

    The android:name, I copied from the error that was pointed out in the merged manifest right after <activity#

    I'm still running tests to see if that changed anything somehow because I don't know much about Android Manifest files.
     
    niirirgomel likes this.
  30. Slash_P

    Slash_P

    Joined:
    Apr 8, 2022
    Posts:
    4
    Hello there, looking at you screen shot, it seems you did that in Unity 2018 or earlier, if so, I would really like to know more, because I can fix the problem in U 2019, but need to fix it in U 2018, because the prefabs of my clients do not work in U 2019.

    Greetings
     
  31. venkat-rongali

    venkat-rongali

    Joined:
    Jul 12, 2016
    Posts:
    1
    Just add this code android manifest.xml solve that issue
    <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.google.unity.ads" android:versionName="1.0" android:versionCode="1">
    <application>
    <uses-library android:required="false" android:name="org.apache.http.legacy" />
    <meta-data android:name="com.google.android.gms.ads.AD_MANAGER_APP" android:value="true" />
    <meta-data android:name="com.google.android.gms.ads.APPLICATION_ID" android:value="ca-app-pub-6141842313326803~7552175435" />
    <activity android:name="com.unity3d.player.UnityPlayerActivity" android:theme="@StyLe/UnityThemeSelector" 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>
    </application>
    </manifest>
     
  32. vshim

    vshim

    Joined:
    May 18, 2016
    Posts:
    6
    Sharing my experience for those who has fresh Unity version which sets android:exported attribute itself. But still gets the error in google console.

    I built an APK, decompiled it(https://github.com/AndnixSH/APKToolGUI for example) to see merged AndroidManifest.xml
    There I found that some Applovin MAX adapter was using intent-filter without android:exported attribute.
    Updating the adapter to the latest version fixed the issue
     
  33. Mamoon178

    Mamoon178

    Joined:
    Jul 26, 2017
    Posts:
    36
  34. unity_AD542DE2D778977C44DC

    unity_AD542DE2D778977C44DC

    Joined:
    Aug 17, 2022
    Posts:
    6
    Hi, sorry to bother you. I was wondering if you can help me.
    I have the error
    "uploaded an APK or Android App Bundle which has an activity, activity alias, service or broadcast receiver with intent filter,..."

    I try to fix it by uploading AndroidManifestPostProcessor file But the problem continues.

    My unity version is 2019.1.5f1
    I hope I can fix it without upgrading unity because by doing so the project has a lot of bugs.

    This is my AndroidManifest:

    Code (CSharp):
    1. <?xml version="1.0" encoding="utf-8" standalone="no"?><manifest xmlns:android="http://schemas.android.com/apk/res/android" android:compileSdkVersion="33" android:compileSdkVersionCodename="13" android:installLocation="preferExternal" package="com.example.BurningMan" platformBuildVersionCode="1" platformBuildVersionName="1.0">
    2.     <supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:smallScreens="true" android:xlargeScreens="true"/>
    3.     <uses-feature android:glEsVersion="0x00020000"/>
    4.     <uses-permission android:name="android.permission.INTERNET"/>
    5.     <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
    6.     <uses-feature android:name="android.hardware.touchscreen" android:required="false"/>
    7.     <uses-feature android:name="android.hardware.touchscreen.multitouch" android:required="false"/>
    8.     <uses-feature android:name="android.hardware.touchscreen.multitouch.distinct" android:required="false"/>
    9.     <uses-permission android:name="android.permission.WAKE_LOCK"/>
    10.     <uses-permission android:name="com.google.android.finsky.permission.BIND_GET_INSTALL_REFERRER_SERVICE"/>
    11.     <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE"/>
    12.     <uses-permission android:name="com.android.vending.BILLING"/>
    13.     <uses-feature android:name="android.software.vr.mode" android:required="false"/>
    14.     <uses-feature android:name="android.software.vr.high_performance" android:required="false"/>
    15.     <application android:allowBackup="true" android:debuggable="false" android:hardwareAccelerated="true" android:icon="@mipmap/app_icon" android:label="@string/app_name" android:theme="@style/UnityThemeSelector">
    16.         <activity android:configChanges="density|fontScale|keyboard|keyboardHidden|layoutDirection|locale|mcc|mnc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|touchscreen|uiMode" android:exported="true" android:hardwareAccelerated="true" android:label="@string/app_name" android:launchMode="singleTask" android:name="com.unity3d.player.UnityPlayerActivity" android:screenOrientation="portrait">
    17.             <intent-filter>
    18.                 <action android:name="android.intent.action.MAIN"/>
    19.                 <category android:name="android.intent.category.LAUNCHER"/>
    20.             </intent-filter>
    21.             <meta-data android:name="unityplayer.UnityActivity" android:value="true"/>
    22.             <meta-data android:name="android.notch_support" android:value="true"/>
    23.         </activity>
    24.         <meta-data android:name="unity.build-id" android:value="3e47d957-3df9-4084-af62-ff44c72ab607"/>
    25.         <meta-data android:name="unity.splash-mode" android:value="0"/>
    26.         <meta-data android:name="unity.splash-enable" android:value="true"/>
    27.         <meta-data android:name="notch.config" android:value="portrait|landscape"/>
    28.         <meta-data android:name="android.arch.lifecycle.VERSION" android:value="27.0.0-SNAPSHOT"/>
    29.         <meta-data android:name="android.support.VERSION" android:value="26.1.0"/>
    30.         <activity android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize|uiMode" android:exported="false" android:name="com.google.android.gms.ads.AdActivity" android:theme="@android:style/Theme.Translucent"/>
    31.         <provider android:authorities="com.example.BurningMan.mobileadsinitprovider" android:exported="false" android:initOrder="100" android:name="com.google.android.gms.ads.MobileAdsInitProvider"/>
    32.         <activity android:exported="false" android:name="com.google.android.gms.common.api.GoogleApiActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar"/>
    33.         <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version"/>
    34.         <receiver android:enabled="true" android:exported="false" android:name="com.google.android.gms.measurement.AppMeasurementReceiver"/>
    35.         <receiver android:enabled="true" android:exported="true" android:name="com.google.android.gms.measurement.AppMeasurementInstallReferrerReceiver" android:permission="android.permission.INSTALL_PACKAGES">
    36.             <intent-filter>
    37.                 <action android:name="com.android.vending.INSTALL_REFERRER"/>
    38.             </intent-filter>
    39.         </receiver>
    40.         <service android:enabled="true" android:exported="false" android:name="com.google.android.gms.measurement.AppMeasurementService"/>
    41.         <service android:enabled="true" android:exported="false" android:name="com.google.android.gms.measurement.AppMeasurementJobService" android:permission="android.permission.BIND_JOB_SERVICE"/>
    42.         <service android:exported="false" android:name="com.google.firebase.components.ComponentDiscoveryService">
    43.             <meta-data android:name="com.google.firebase.components:com.google.firebase.analytics.connector.internal.AnalyticsConnectorRegistrar" android:value="com.google.firebase.components.ComponentRegistrar"/>
    44.             <meta-data android:name="com.google.firebase.components:com.google.firebase.iid.Registrar" android:value="com.google.firebase.components.ComponentRegistrar"/>
    45.         </service>
    46.         <provider android:authorities="com.example.BurningMan.firebaseinitprovider" android:exported="false" android:initOrder="100" android:name="com.google.firebase.provider.FirebaseInitProvider"/>
    47.         <receiver android:exported="true" android:name="com.google.firebase.iid.FirebaseInstanceIdReceiver" android:permission="com.google.android.c2dm.permission.SEND">
    48.             <intent-filter>
    49.                 <action android:name="com.google.android.c2dm.intent.RECEIVE"/>
    50.             </intent-filter>
    51.         </receiver>
    52.         <activity android:configChanges="fontScale|keyboard|keyboardHidden|locale|mcc|mnc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|touchscreen|uiMode" android:name="com.unity.purchasing.googleplay.PurchaseActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen"/>
    53.         <activity android:configChanges="fontScale|keyboard|keyboardHidden|locale|mcc|mnc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|touchscreen|uiMode" android:enableVrMode="com.google.vr.vrcore/com.google.vr.vrcore.common.VrCoreListenerService" android:name="com.unity.purchasing.googleplay.VRPurchaseActivity" android:theme="@style/VrActivityTheme">
    54.             <intent-filter>
    55.                 <action android:name="com.google.vr.vrcore.ACTION_NONE"/>
    56.                 <category android:name="com.google.intent.category.DAYDREAM"/>
    57.             </intent-filter>
    58.         </activity>
    59.         <activity android:configChanges="fontScale|keyboard|keyboardHidden|locale|mcc|mnc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|touchscreen|uiMode" android:hardwareAccelerated="true" android:name="com.unity3d.services.ads.adunit.AdUnitActivity" android:theme="@android:style/Theme.NoTitleBar.Fullscreen"/>
    60.         <activity android:configChanges="fontScale|keyboard|keyboardHidden|locale|mcc|mnc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|touchscreen|uiMode" android:hardwareAccelerated="true" android:name="com.unity3d.services.ads.adunit.AdUnitTransparentActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen"/>
    61.         <activity android:configChanges="fontScale|keyboard|keyboardHidden|locale|mcc|mnc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|touchscreen|uiMode" android:hardwareAccelerated="false" android:name="com.unity3d.services.ads.adunit.AdUnitTransparentSoftwareActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen"/>
    62.         <activity android:configChanges="fontScale|keyboard|keyboardHidden|locale|mcc|mnc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|touchscreen|uiMode" android:hardwareAccelerated="false" android:name="com.unity3d.services.ads.adunit.AdUnitSoftwareActivity" android:theme="@android:style/Theme.NoTitleBar.Fullscreen"/>
    63.         <uses-library android:name="org.apache.http.legacy" android:required="false"/>
    64.         <meta-data android:name="com.google.android.gms.ads.APPLICATION_ID" android:value="ca-app-pub-3940256099942544~3347511713"/>
    65.     </application>
    66. </manifest>

    Do you know how I can solve it? Thank you very much.
     
  35. Voxel-Busters

    Voxel-Busters

    Joined:
    Feb 25, 2015
    Posts:
    1,961
    Sure!
    This is where the issue is...

    Code (CSharp):
    1.         <activity android:configChanges="fontScale|keyboard|keyboardHidden|locale|mcc|mnc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|touchscreen|uiMode" android:name="com.unity.purchasing.googleplay.PurchaseActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen"/>
    2.         <activity android:configChanges="fontScale|keyboard|keyboardHidden|locale|mcc|mnc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|touchscreen|uiMode" android:enableVrMode="com.google.vr.vrcore/com.google.vr.vrcore.common.VrCoreListenerService" android:name="com.unity.purchasing.googleplay.VRPurchaseActivity" android:theme="@style/VrActivityTheme">
    3.             <intent-filter>
    4.                 <action android:name="com.google.vr.vrcore.ACTION_NONE"/>
    5.                 <category android:name="com.google.intent.category.DAYDREAM"/>
    6.             </intent-filter>
    7.         </activity>
    It's missing android:exported flag in activity tag. I assume this is your final merged manifest. If not cross check your final manifest and fix if above change doesn't fix it.

    We consolidated all the errors related to API 31 over here. You can have a look at it to how to fix on your own if you get similar issues anytime :)
     
    Last edited: Aug 20, 2022
  36. Jasnik

    Jasnik

    Joined:
    Oct 20, 2018
    Posts:
    3
    I found a very simple solution : I'm still on 2019.4.6f1
    So I ticked the Custom Main Manifest in Publishing Settings / Build section
    opened the Assets\Plugins\Android\AndroidManifest.xml in notepad
    Then Just added android:exported="true" in the activity section.

    Then ran the build and error went away from Google.
    Note if you put false the app wont launch direct from the google play store. I found that out the hard way....

    <application>
    <activity android:name="com.unity3d.player.UnityPlayerActivity"
    android:theme="@StyLe/UnityThemeSelector"
    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>
    </application>
     
  37. WaqasGameDev

    WaqasGameDev

    Joined:
    Apr 17, 2020
    Posts:
    118
    This is for Unity Developers in specific and for any frame work targeting android platform in general. If by any means, you are not able to publish even if you have added android:exported property to every activity/receiver containing intent filter, then you should do this approach and hopefully you will be able to solve the issue.

    Problem

    Recently, Playstore started to require apps / games to target API 31. You updated SDK, Gradle and all that stuff. You got a build, published to PlayStore and now Playstore is telling you, this

    you uploaded an APK or Android App Bundle which has an activity, activity alias, service or broadcast receiver with intent filter, but without 'android:exported' property set.

    YOU HAVE ALREADY TRIED

    You now know that the Android Manifests including in you app / game contains some Activities, receivers, activity-alias etc which contain intent-filter but does not have android:exported property set to true or false.

    You tried adding this property to all of the Manifests and unity 's own manifest by Enablisng Custom Android Manifest too. But still Playstore is not accepting the app.

    You don't want to update Unity version to fix this. You still have a solution.

    Let's Narrows down

    You are doing good in adding android:exported property but when you are getting build, not all of those tags persist. During build, unity is replacing you properties, especially properties related to external plugins you have used in your app.

    So lets have a look which plugins contain problematic activities/receivers etc.

    Instead of building a bundle or apk, Export your unity project as Android Project.

    Open project in android studio, and build there.

    After build is complete, go to this file which is the Merged Menifest containing data from all individual manifests. (Please check attached image for how it looks like)

    YourExportedProjectFolder\launcher\build\intermediates\merged_manifests\release

    Go precisely through this file and check which activities/receivers etc does not contain exported:property set. Not down that plugin. That is the culprit.

    Let's fix it

    Go back to unity, go to the relevant plugin manifest, copy those specific problematic activities (Complete i.e. along with intent-filters) from that manifest and paste to

    Assets/Plugin/Android/AndroidManifest

    Something like this

    Code (CSharp):
    1. <receiver android:name="universal.tools.notifications.ScheduledNotificationsRestorer"
    2. android:exported="true"
    3. tools:replace="android:exported">
    4.   <intent-filter>
    5.     <action android:name="android.intent.action.BOOT_COMPLETED" />
    6.   </intent-filter>
    7. </receiver>
    Now build again and you should be good to go!
     

    Attached Files:

  38. dezzell

    dezzell

    Joined:
    Feb 7, 2015
    Posts:
    32
    This fixed my issue from Voxel-Busters. https://forum.unity.com/threads/game-doesnt-install-on-android-12-from-playstore.1222065

    using the code from this link within AndroidManifestPostProcessor.cs under editor folder. I went to upload an update on Google Play last night, told me version 30 is obsolete, I changed minimum version to 31, attempted to use 33 as highest version, and kept getting an error in Java Player after build, so switched highest to 32, minimum to 31. Then got the error on Google Play about intent, services, activities and android:exported = "true", went through many articles, and this article did the trick. Did not have to tweak the code, just copied the code to the editor folder, did a new build, and it worked when I uploaded to Google Play. I am on 2020.3.16f for this project.

    For those who need to update Android SDK for Unity, I used Android Studio, however it just updated under Studio, which Unity3D is using it's own SDK folders, I copied the folders from Studio platform to Unity3D platform folder, thou had issues with Java Player.

    So I found this Windows CMD line which updated Android in the Unity3D SDK folders.

    Open CMD from run or search CMD, run as Administrator, may work without, and update the path below to your JDK and SDK folders. Something wrong with version 33. So if you get a Java Player error after build, use max level 32.

    When I went to Build with 31 selected, a msg came up to update during build, but it generated an error, so the commands below downloaded the updates for Android.

    c:
    set JAVA_HOME=C:\Program Files\Unity\Hub\Editor\2020.3.16f1\Editor\Data\PlaybackEngines\AndroidPlayer\OpenJDK\
    set ANDROID_HOME=C:\Program Files\Unity\Hub\Editor\2020.3.16f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\
    cd %ANDROID_HOME%SDK\tools\bin\
    echo.> %USERPROFILE%\.android\repositories.cfg

    cmd /C sdkmanager --update
    cmd /C sdkmanager "platform-tools" "platforms;android-31"
    cmd /C sdkmanager "platform-tools" "platforms;android-32"
    cmd /C sdkmanager "platform-tools" "platforms;android-33"


    Enjoy your time and keep creating amazing works of art :)
     
    giggioz and Voxel-Busters like this.
  39. giggioz

    giggioz

    Joined:
    May 11, 2017
    Posts:
    52
    It worked for me, thanks!

     
    Voxel-Busters likes this.
  40. lorenzostudiosok

    lorenzostudiosok

    Joined:
    Feb 3, 2020
    Posts:
    30
    Hello, I have Unity version 2019.2.17f1 and it is a project that I cannot migrate to a more recent version, with which I have to work yes or yes in version 2019.2.17.f1.

    To compile in API Level 31 I have this error:

    Failed to commit install session 458721566 with command cmd package install-commit 458721566. Error: INSTALL_PARSE_FAILED_MANIFEST_MALFORMED: Failed parse during installPackageLI: /data/app/vmdl458721566.tmp/base.apk (at Binary XML file line #182): com.unity.purchasing.googleplay.VRPurchaseActivity: Targeting S+ (version 31 and above) requires that an explicit value for android:exported be defined when intent filters are present

    I had solved this same thing in other projects by updating the Unity version, does anyone know if with the 2019 version that I mentioned it is possible to make it work for API Level 31?
     
  41. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,729
    You need a custom manifest that does have exported attribute. Easiest way to do it is to export Android Studio project from Unity, modify the manifest and then put that manifest into Unity project as a manifest template.
     
  42. lorenzostudiosok

    lorenzostudiosok

    Joined:
    Feb 3, 2020
    Posts:
    30
    Ok I understand, I've never done it but I just saw a video on how to export the project from Unity and then import it from Android Studio, I'll try to modify that manifest, but then how do I tell Unity to use that manifest? I just replace it with the other one that is in: "\Assets\Plugins\Android"? Remember that my version of unity does not have the option to use a custom manifest:

    upload_2023-2-3_9-30-5.png
     
  43. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,729
    Yes, Assets/Plugins/Android is the directory you place the custom manifest to. Even in newer versions where we have an option it is also the same place, only less magic.
     
  44. lorenzostudiosok

    lorenzostudiosok

    Joined:
    Feb 3, 2020
    Posts:
    30
    Thanks!
     
  45. John_RM

    John_RM

    Joined:
    Nov 30, 2019
    Posts:
    4
    Hi, I have a problem in the Android Manifest file after build :
    Code (CSharp):
    1. <receiver
    2.             android:name="androidx.work.impl.background.systemalarm.ConstraintProxyUpdateReceiver"
    3.             android:enabled="(reference) @0x7f020000"
    4.             android:exported="false"
    5.             android:directBootAware="false">
    6.             <intent-filter>
    7.                 <action
    8.                     android:name="androidx.work.impl.background.systemalarm.UpdateProxies"/>
    9.             </intent-filter>
    10.         </receiver>
    11.         <receiver
    12.             android:name="androidx.work.impl.background.systemalarm.RescheduleReceiver"
    13.             android:enabled="false"
    14.             android:exported="false"
    15.             android:directBootAware="false">
    16.             <intent-filter>
    17.                 <action
    18.                     android:name="android.intent.action.TIMEZONE_CHANGED"/>
    19.                 <action
    20.                     android:name="android.intent.action.TIME_SET"/>
    21.                 <action
    22.                     android:name="android.intent.action.BOOT_COMPLETED"/>
    23.             </intent-filter>
    24.         </receiver>
    25.         <receiver
    26.             android:name="androidx.work.impl.background.systemalarm.ConstraintProxy$NetworkStateProxy"
    27.             android:enabled="false"
    28.             android:exported="false"
    29.             android:directBootAware="false">
    30.             <intent-filter>
    31.                 <action
    32.                     android:name="android.net.conn.CONNECTIVITY_CHANGE"/>
    33.             </intent-filter>
    34.         </receiver>
    35.         <receiver
    36.             android:name="androidx.work.impl.background.systemalarm.ConstraintProxy$StorageNotLowProxy"
    37.             android:enabled="false"
    38.             android:exported="false"
    39.             android:directBootAware="false">
    40.             <intent-filter>
    41.                 <action
    42.                     android:name="android.intent.action.DEVICE_STORAGE_OK"/>
    43.                 <action
    44.                     android:name="android.intent.action.DEVICE_STORAGE_LOW"/>
    45.             </intent-filter>
    46.         </receiver>
    47.         <receiver
    48.             android:name="androidx.work.impl.background.systemalarm.ConstraintProxy$BatteryNotLowProxy"
    49.             android:enabled="false"
    50.             android:exported="false"
    51.             android:directBootAware="false">
    52.             <intent-filter>
    53.                 <action
    54.                     android:name="android.intent.action.BATTERY_LOW"/>
    55.                 <action
    56.                     android:name="android.intent.action.BATTERY_OKAY"/>
    57.             </intent-filter>
    58.         </receiver>
    59.         <receiver
    60.             android:name="androidx.work.impl.background.systemalarm.ConstraintProxy$BatteryChargingProxy"
    61.             android:enabled="false"
    62.             android:exported="false"
    63.             android:directBootAware="false">
    64.             <intent-filter>
    65.                 <action
    66.                     android:name="android.intent.action.ACTION_POWER_DISCONNECTED"/>
    67.                 <action
    68.                     android:name="android.intent.action.ACTION_POWER_CONNECTED"/>
    69.             </intent-filter>
    70.         </receiver>
    it uses "intent-filter" but with (android:exported="false") so how to fix it?
    and I really don't know if there are other problems so I attached what is written in my Manifest.
    using unity 2021.3.18f1

    edit* : the app crash on launch on android 12
     

    Attached Files:

  46. Voxel-Busters

    Voxel-Busters

    Joined:
    Feb 25, 2015
    Posts:
    1,961
    If it's exported flag issue, it won't even install. So you can rule this out as you can install but crash at runtime.
    Share the crash log so that we can have a look.
     
  47. John_RM

    John_RM

    Joined:
    Nov 30, 2019
    Posts:
    4
    ok so I tried to use Logcat (It is my first time) and I think I got all the important information in the attached file
     

    Attached Files:

    Last edited: Feb 10, 2023
  48. rrraa

    rrraa

    Joined:
    Dec 21, 2017
    Posts:
    5
    did it work?
     
  49. lorenzostudiosok

    lorenzostudiosok

    Joined:
    Feb 3, 2020
    Posts:
    30
    Yes, I exported the project and then took the manifest with the necessary values, I put it in the Unity project and I was able to export it with that custom manifest that by default in that version of unity did not let me.
     
  50. VoldemortEatsBurgers

    VoldemortEatsBurgers

    Joined:
    Jun 28, 2021
    Posts:
    6
    Hi all! I also encountered the problem described above. All the solutions that I saw in the discussions of this problem did not help me. The source of the problem was the Unity Mobile Notifications plugin.
    I was helped by updating this plugin to the latest version. If the source of your problem is the same as mine, go to the Package Manager, find this plugin and update. Do the build itself NOT with a custom manifest.
    Good luck and I hope my advice helps someone! :)
    Note: my version of Unity is 2021.2.5f1