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

When you upload your app bundle or apk in playstore, you have to see this problem.

If you are using Android Studio, you can resolve this problem by adding “android:exported=true” in your android manifest file.

Simply buid the application and your upload on playstore and your problem will be resolved.

 

If you are using any activity, intent, or broadcast receiver in your android Manifest file, then you have to set android export value to true.

If you are using unity 3d, here is the step by step solution to solve this problem

Step -1

Create a new folder name "Editor" in Assets Folder

Step -2

Now open the editor folder, right click and create a C sharp script. And name this Script

"AndroidManifestPostProcessor"

Step -3

Open this Script and remove all the text written into it.
Make this file completely blank(Empty).

Step -4

Now copy all code written below and paste into "AndroidManifestPostProcessor" file

Here is the code :-


//Taken from Cross Platform Native Plugins : Essential Kit (http://u3d.as/1szE)
#if UNITY_EDITOR && UNITY_ANDROID
using System.IO;
using System.Text;
using System.Xml;
using UnityEditor.Android;

//Reference : https://github.com/Over17/UnityAndroidManifestCallback
namespace VoxelBusters.EssentialKit.Editor.Android
{
public class AndroidManifestPostProcessor : IPostGenerateGradleAndroidProject
{
public void OnPostGenerateGradleAndroidProject(string basePath)
{
AndroidManifest androidManifest = new AndroidManifest(GetManifestPath(basePath));

//For forcing android hardwareAccelerated flag
androidManifest.SetApplicationAttribute(“hardwareAccelerated”, “true”);
androidManifest.SetStartingActivityAttribute(“hardwareAccelerated”, “true”);

//For forcing debuggable flag
androidManifest.SetApplicationAttribute(“debuggable”, UnityEditor.EditorUserBuildSettings.development ? “true” : “false”);

// For API 31+ support (Need explicit exported flag for entries having intent-filter tags)
androidManifest.SetStartingActivityAttribute(“exported”, “true”);

androidManifest.Save();
}

public int callbackOrder { get { return 1; } }

private string _manifestFilePath;

private string GetManifestPath(string basePath)
{
if (string.IsNullOrEmpty(_manifestFilePath))
{
StringBuilder pathBuilder = new StringBuilder(basePath);
pathBuilder.Append(Path.DirectorySeparatorChar).Append(“src”);
pathBuilder.Append(Path.DirectorySeparatorChar).Append(“main”);
pathBuilder.Append(Path.DirectorySeparatorChar).Append(“AndroidManifest.xml”);
_manifestFilePath = pathBuilder.ToString();
}
return _manifestFilePath;
}
}


internal class AndroidXmlDocument : XmlDocument
{
private string m_Path;
protected XmlNamespaceManager nsMgr;
public readonly string AndroidXmlNamespace = “http://schemas.android.com/apk/res/android”;
public AndroidXmlDocument(string path)
{
m_Path = path;
using (var reader = new XmlTextReader(m_Path))
{
reader.Read();
Load(reader);
}
nsMgr = new XmlNamespaceManager(NameTable);
nsMgr.AddNamespace(“android”, AndroidXmlNamespace);
}

public string Save()
{
return SaveAs(m_Path);
}

public string SaveAs(string path)
{
using (var writer = new XmlTextWriter(path, new UTF8Encoding(false)))
{
writer.Formatting = Formatting.Indented;
Save(writer);
}
return path;
}
}


internal class AndroidManifest : AndroidXmlDocument
{
private readonly XmlElement ApplicationElement;

public AndroidManifest(string path) : base(path)
{
ApplicationElement = SelectSingleNode(“/manifest/application”) as XmlElement;
}

private XmlAttribute CreateAndroidAttribute(string key, string value)
{
XmlAttribute attr = CreateAttribute(“android”, key, AndroidXmlNamespace);
attr.Value = value;
return attr;
}

internal XmlNode GetActivityWithLaunchIntent()
{
return SelectSingleNode(“/manifest/application/activity[intent-filter/action/@android:name=’android.intent.action.MAIN’ and ” +
“intent-filter/category/@android:name=’android.intent.category.LAUNCHER’]”, nsMgr);
}

internal void SetApplicationTheme(string appTheme)
{
ApplicationElement.Attributes.Append(CreateAndroidAttribute(“theme”, appTheme));
}

internal void SetStartingActivityName(string activityName)
{
GetActivityWithLaunchIntent().Attributes.Append(CreateAndroidAttribute(“name”, activityName));
}

internal void SetApplicationAttribute(string key, string value)
{
ApplicationElement.Attributes.Append(CreateAndroidAttribute(key, value));
}

internal void SetStartingActivityAttribute(string key, string value)
{
XmlNode node = GetActivityWithLaunchIntent();
if (node != null)
{
XmlAttributeCollection attributes = node.Attributes;
attributes.Append(CreateAndroidAttribute(key, value));
}
}
}
}
#endif

Step -5

Congratulations ! Now you are done with all processess.

Now Simply build your "apk" or "Android App Bundle"

Now! once your app is build, upload it on the playstore,

As you can see, app bundle is uploaded successfully on playstore with Target SDK level "32"

If you still feel any problem, Let us know in Comment Section.

Best Regards
Team Naisky

Leave a Reply

Your email address will not be published. Required fields are marked *

WhatsApp chat