API LEVEL 34 java.lang.SecurityException: One of RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED

the issue i am facing when ever i try to run game build on api level 34 it gives me following error
java.lang.SecurityException: com.yourcompany.yourproject: One of RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED should be specified when a receiver isn’t being registered exclusively for system broadcasts … i know games works without any issue on api level 33 but from this august google policy is going to be changed and then minimum api level will be incremented to 34 minimum
so i have to package game for api level 34 or up … for further details i am going to mention my mobile phone log below:
java.lang.SecurityException: com.yourcompany.yourproject: One of RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED should be specified when a receiver isn’t being registered exclusively for system broadcasts
at android.os.Parcel.createExceptionOrNull(Parcel.java:3057)
at android.os.Parcel.createException(Parcel.java:3041)
at android.os.Parcel.readException(Parcel.java:3024)
at android.os.Parcel.readException(Parcel.java:2966)
at android.app.IActivityManager$Stub$Proxy.registerReceiverWithFeature(IActivityManager.java:6205)
at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:1863)
at android.app.ContextImpl.registerReceiver(ContextImpl.java:1803)
at android.app.ContextImpl.registerReceiver(ContextImpl.java:1791)
at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:766)
at com.epicgames.ue4.GameActivity.onStart(GameActivity.java:607)
at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1596)
at android.app.Activity.performStart(Activity.java:8923)
at android.app.ActivityThread.handleStartActivity(ActivityThread.java:4068)
at android.app.servertransaction.TransactionExecutor.performLifecycleSequence(TransactionExecutor.java:235)
at android.app.servertransaction.TransactionExecutor.cycleToPath(TransactionExecutor.java:215)
at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:187)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:101)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2616)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:222)
at android.os.Looper.loop(Looper.java:314)
at android.app.ActivityThread.main(ActivityThread.java:8706)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:565)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)
Caused by: android.os.RemoteException: Remote stack trace:
at com.android.server.am.ActivityManagerService.registerReceiverWithFeature(ActivityManagerService.java:14678)
at android.app.IActivityManager$Stub.onTransact$registerReceiverWithFeature$(IActivityManager.java:12225)
at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:3194)
at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:2884)
at android.os.Binder.execTransactInternal(Binder.java:1346)
2024-06-04 02:50:47.267 805-805/? W/main: type=1400 audit(0.0:346449): avc: denied { search } for name=“miuilog” dev=“dm-58” ino=570 scontext=u:r:untrusted_app:s0:c79,c257,c512,c768 tcontext=u:object_r:data_log_file:s0 tclass=dir permissive=0 app=com.yourcompany.yourproject
2024-06-04 02:50:47.267 805-805/? W/main: type=1400 audit(0.0:346450): avc: denied { search } for name=“miuilog” dev=“dm-58” ino=570 scontext=u:r:untrusted_app:s0:c79,c257,c512,c768 tcontext=u:object_r:data_log_file:s0 tclass=dir permissive=0 app=com.yourcompany.yourproject
2024-06-04 02:50:47.267 805-805/? W/main: type=1400 audit(0.0:346451): avc: denied { search } for name=“miuilog” dev=“dm-58” ino=570 scontext=u:r:untrusted_app:s0:c79,c257,c512,c768 tcontext=u:object_r:data_log_file:s0 tclass=dir permissive=0 app=com.yourcompany.yourproject
2024-06-04 02:50:47.267 805-805/? W/main: type=1400 audit(0.0:346452): avc: denied { search } for name=“miuilog” dev=“dm-58” ino=570 scontext=u:r:untrusted_app:s0:c79,c257,c512,c768 tcontext=u:object_r:data_log_file:s0 tclass=dir permissive=0 app=com.yourcompany.yourproject
2024-06-04 02:50:47.267 805-805/? W/main: type=1400 audit(0.0:346453): avc: denied { search } for name=“miuilog” dev=“dm-58” ino=570 scontext=u:r:untrusted_app:s0:c79,c257,c512,c768 tcontext=u:object_r:data_log_file:s0 tclass=dir permissive=0 app=com.yourcompany.yourproject
2024-06-04 02:50:47.267 805-805/? W/main: type=1400 audit(0.0:346454): avc: denied { search } for name=“miuilog” dev=“dm-58” ino=570 scontext=u:r:untrusted_app:s0:c79,c257,c512,c768 tcontext=u:object_r:data_log_file:s0 tclass=dir permissive=0 app=com.yourcompany.yourproject
2024-06-04 02:50:47.274 805-805/? W/ScoutUtils: Failed to mkdir /data/miuilog/stability/memleak/heapdump/
2024-06-04 02:50:47.267 805-805/? W/main: type=1400 audit(0.0:346455): avc: denied { getattr } for path=“/data/miuilog” dev=“dm-58” ino=570 scontext=u:r:untrusted_app:s0:c79,c257,c512,c768 tcontext=u:object_r:data_log_file:s0 tclass=dir permissive=0 app=com.yourcompany.yourproject
2024-06-04 02:50:47.267 805-805/? W/main: type=1400 audit(0.0:346456): avc: denied { search } for name=“miuilog” dev=“dm-58” ino=570 scontext=u:r:untrusted_app:s0:c79,c257,c512,c768 tcontext=u:object_r:data_log_file:s0 tclass=dir permissive=0 app=com.yourcompany.yourproject
2024-06-04 02:50:47.267 805-805/? W/main: type=1400 audit(0.0:346457): avc: denied { search } for name=“miuilog” dev=“dm-58” ino=570 scontext=u:r:untrusted_app:s0:c79,c257,c512,c768 tcontext=u:object_r:data_log_file:s0 tclass=dir permissive=0 app=com.yourcompany.yourproject
2024-06-04 02:50:47.306 805-805/? I/Process: Process is going to kill itself!
java.lang.Exception
at android.os.Process.killProcess(Process.java:1346)
at com.android.internal.os.RuntimeInit$KillApplicationHandler.uncaughtException(RuntimeInit.java:178)
at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:1071)
at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:1066)
at java.lang.Thread.dispatchUncaughtException(Thread.java:2306)
2024-06-04 02:50:47.306 805-805/? I/Process: Sending signal. PID: 805 SIG: 9
`**NOW HERE IS MY PICS OF PACKING DETAILS **


AND ALSO THIS ONE

**ONE THING I NEED TO MENTION MORE I HAVE TRIED MANYS WAYS TO FIX THIS ISSUE IN UE4.27.2 **
I TRIED TO UPDATE MY ANDRIOD XML FILE WITH THE HELP OF UPL METHOD
AND HERE IS MY XML FILE

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.company.app"
    android:installLocation="internalOnly"
    android:versionCode="1"
    android:versionName="1.0">

    <queries>
        <intent>
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.BROWSABLE" />
            <data android:scheme="http" />
        </intent>
        <intent>
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.BROWSABLE" />
            <data android:scheme="https" />
        </intent>
    </queries>

    <!-- Application Definition -->
    <application
        android:label="@string/app_name"
        android:icon="@drawable/icon"
        android:hardwareAccelerated="true"
        android:extractNativeLibs="true"
        android:name="com.epicgames.ue4.GameApplication"
        android:requestLegacyExternalStorage="true"
        android:hasCode="true">

        <activity
            android:exported="true"
            android:name="com.epicgames.ue4.GameActivity"
            android:label="@string/app_name"
            android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"
            android:configChanges="mcc|mnc|uiMode|density|screenSize|smallestScreenSize|screenLayout|orientation|keyboardHidden|keyboard"
            android:resizeableActivity="false"
            android:launchMode="singleTask"
            android:screenOrientation="sensorLandscape"
            android:debuggable="true">
            <meta-data android:name="android.app.lib_name" android:value="UE4" />
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <activity android:name=".DownloaderActivity" />

        <meta-data android:name="com.epicgames.ue4.GameActivity.EngineVersion" android:value="4.27.2" />
        <meta-data android:name="com.epicgames.ue4.GameActivity.EngineBranch" android:value="++UE4+Release-4.27" />
        <meta-data android:name="com.epicgames.ue4.GameActivity.ProjectVersion" android:value="1.0.0.0" />
        <meta-data android:name="com.epicgames.ue4.GameActivity.DepthBufferPreference" android:value="0" />
        <meta-data android:name="com.epicgames.ue4.GameActivity.bPackageDataInsideApk" android:value="true" />
        <meta-data android:name="com.epicgames.ue4.GameActivity.bVerifyOBBOnStartUp" android:value="false" />
        <meta-data android:name="com.epicgames.ue4.GameActivity.bShouldHideUI" android:value="true" />
        <meta-data android:name="com.epicgames.ue4.GameActivity.ProjectName" android:value="demoEvilex2" />
        <meta-data android:name="com.epicgames.ue4.GameActivity.AppType" android:value="" />
        <meta-data android:name="com.epicgames.ue4.GameActivity.bHasOBBFiles" android:value="true" />
        <meta-data android:name="com.epicgames.ue4.GameActivity.BuildConfiguration" android:value="Development" />
        <meta-data android:name="com.epicgames.ue4.GameActivity.CookedFlavors" android:value="ETC2,DXT,ASTC" />
        <meta-data android:name="com.epicgames.ue4.GameActivity.bValidateTextureFormats" android:value="true" />
        <meta-data android:name="com.epicgames.ue4.GameActivity.bUseExternalFilesDir" android:value="false" />
        <meta-data android:name="com.epicgames.ue4.GameActivity.bPublicLogFiles" android:value="false" />
        <meta-data android:name="com.epicgames.ue4.GameActivity.bUseDisplayCutout" android:value="false" />
        <meta-data android:name="com.epicgames.ue4.GameActivity.bAllowIMU" android:value="false" />
        <meta-data android:name="com.epicgames.ue4.GameActivity.bSupportsVulkan" android:value="false" />
        <meta-data android:name="com.epicgames.ue4.GameActivity.StartupPermissions" android:value="android.permission.WRITE_EXTERNAL_STORAGE" />
        <meta-data android:name="com.google.android.gms.games.APP_ID" android:value="@string/app_id" />
        <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
        <service android:name="OBBDownloaderService" />
        <receiver android:name="AlarmReceiver" android:exported="false" />
        <receiver android:name="com.epicgames.ue4.LocalNotificationReceiver" android:exported="false" />
        <receiver android:exported="true" android:name="com.epicgames.ue4.MulticastBroadcastReceiver">
            <intent-filter>
                <action android:name="com.android.vending.INSTALL_REFERRER" />
            </intent-filter>
        </receiver>
        <meta-data android:name="android.max_aspect" android:value="2.10" />
        <meta-data android:name="com.oculus.supportedDevices" android:value="quest" />

        <receiver android:name="com.yourcompany.yourproject.AlarmReceiver" android:exported="false" />
        <receiver android:name="com.epicgames.ue4.DownloaderActivity$HappyIslandReceiver" android:exported="true">
            <intent-filter>
                <action android:name="android.action.hxdf.killApp" />
            </intent-filter>
        </receiver>

    </application>

    <!-- Requirements -->
    <uses-feature android:glEsVersion="0x00030001" android:required="true" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <uses-permission android:name="com.android.vending.CHECK_LICENSE" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
    <uses-permission android:name="android.permission.VIBRATE" />
    <uses-permission android:name="com.android.vending.BILLING" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" android:maxSdkVersion="32" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="32" />
</manifest>

I EVEN ADDED THE CODE TO DownloaderActivity.java AT DIRECTORY :PROJECT\Build\Android\src\com\company\app AND CODE THAT I ADDED IS BUT IDK IT WORKED OR ADDED IN GAME

package com.company.app;

import android.app.Activity;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.os.Runtime;
import android.util.Log;

public class DownloaderActivity extends Activity {

    private BroadcastReceiver mBroadcastReceiver;

    @Override
    protected void onStart() {
        super.onStart();
        mBroadcastReceiver = new HappyIslandReceiver();
        IntentFilter filter = new IntentFilter("android.action.hxdf.killApp");
        registerReceiver(mBroadcastReceiver, filter);
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        if (mBroadcastReceiver != null) {
            unregisterReceiver(mBroadcastReceiver);
        }
    }

    public static class HappyIslandReceiver extends BroadcastReceiver {
        @Override
        public void onReceive(Context context, Intent intent) {
            if ("android.action.hxdf.killApp".equals(intent.getAction())) {
                Bundle bundle = intent.getExtras();
                if (bundle != null) {
                    Runtime.getRuntime().exit(0);
                    return;
                }
                Runtime.getRuntime().exit(0);
            }
        }
    }
}

IDK HOW TO RUN CUSTOM CODE DURING RUNTIME IN DownloaderActivity.java AT PROJECT\Build\Android\src\com\company\app CAN ANYONE PLEASE TELL ME THIS AS WELL MAYBE I WILL BE ABLE TO FIX THIS ISSUE ,AND AS WELL I TRY TO ADD PLUGIN METIONED IN :https://forums.unrealengine.com/t/androidx-support/465584/6
AND HERE IS THE LINK OF PLUGIN FROM GITHB :https://github.com/ufna/AndroidX-UE4
IN ORDER TO UPDATE OLD GOOGLE LIBRARIES TO ANDROID X IF ANYONE GOT UPDATE ON THIS TELL ME I WOULD BE VERY GLAD TO NOW ANY UPDATE ON THIS ,HOW CAN I FIX THIS ISSUE I TOLD U WHATEVER I DID ALL BEFORE TO FIX THIS ISSUE BUT NON WORKED

1 Like

I’m currently having the same problem. I am in the middle of testing it, but I believe this will work:

In Engine\Build\Android\Java\src\com\epicgames\ue4\GameActivity.java.template (this .template file is used to construct the actual GameActivity.java file that gets packaged)

you can see the call to registerReceiver that is causing the problem in onStart()

registerReceiver(consoleCmdReceiver, new IntentFilter(Intent.ACTION_RUN));

You’ll also see that it is only added in non-shipping builds for receiving console commands, so I think RECEIVER_EXPORTED is the correct option to use here, it just needs adding as a third parameter to the registerReceiver call.

I’ve wrapped it in a targetSdkVersion check to be on the safe side, but it isn’t strictly neccessary. Just replace the current call to registerReceiver with this:

            try 
			{
				PackageInfo packageInfo = getPackageManager().getPackageInfo(getPackageName(), 0);
				targetSdkVersion = packageInfo.applicationInfo.targetSdkVersion;
			}
			catch (PackageManager.NameNotFoundException e) 
			{
				Log.debug(e.getMessage());
			}
			if ( targetSdkVersion >= 34 )
			{
				registerReceiver(consoleCmdReceiver, new IntentFilter(Intent.ACTION_RUN), RECEIVER_EXPORTED);
			}
			else
			{
				registerReceiver(consoleCmdReceiver, new IntentFilter(Intent.ACTION_RUN));
			}

Cheers,
Matt

8 Likes

is it working and did u check for ue 4.27.2

Hi,

had the same issue banging my head for a Week nown until I found your solution and it works on my side straight away with target sdk 34 :slight_smile:

Many big THX Matt!!!

PS: Using Unreal 5.4.2

1 Like

Sorry for the late reply, you’ve probably already figured this out by now but yeh it works for 4.27.2

do you know why i get cannot find symbol error on 5.0.3, it doesn’t recognize the RECIEVER_EXPORTED and points at is as error, 5.3 works but 5.0.3 issues, odd

Great man! well done fixing this one.

This solution address the problem of: “RECEIVER_EXPORTED” also known as: java.lang.securityexception.

it works even in 5.4 →
together with adding the file: “ManifestRequirementsOverride.txt”,
placed in: C:\Users\XXXXX\Documents\Unreal Projects\XXXPROJECT\Build\Android

With this content:

<uses-permission
 android:name="android.permission.WRITE_EXTERNAL_STORAGE"
 android:maxSdkVersion="28"/> 
<uses-sdk android:minSdkVersion="30" android:targetSdkVersion="34" />  
<uses-permission android:name="android.permission.READ_PHONE_STATE"   />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"   />
<uses-permission android:name="android.permission.CAMERA"   />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"   />
<uses-permission android:name="android.permission.RECORD_AUDIO"   /> 

I finally managed to start making my game. what a PAIN.
Grateful.

:crazy_face: :crazy_face: :crazy_face:

Hey, just updating here as it may help someone…

I’m on UE 5.3.2, after having all these changes mentioned above, I was running into exception due to billingclient version 6.0.0. It was part of GooglePlay online subsystem plugin. Updating it to version 7.0.0 helped to fix the exception altogether.

Implementation details are at Android 14, SDK 34, Black screen on startup - #10 by Rush_At_Games

Thanks,
Rush At Games

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.