UNREAL 5.0.3 RECEIVER_EXPORTED error in gameactivity.java.template for 34+ api

hi, im facing a simple issue, where the build seems to fail upon not recognizing the “symbol” for RECEIVER_EXPORTED, i thought id ask if someone has expereinced the same and knew the issue:

\GameActivity.java:768: error: cannot find symbol
registerReceiver(consoleCmdReceiver, new IntentFilter(Intent.ACTION_RUN), RECEIVER_EXPORTED);

this is the error, cannot find symbol, and it occurs when i change the
//registerReceiver(consoleCmdReceiver, new IntentFilter(Intent.ACTION_RUN));
to
registerReceiver(consoleCmdReceiver, new IntentFilter(Intent.ACTION_RUN), RECEIVER_EXPORTED);
in the gameactivity.java.template in UE_5.0\Engine\Build\Android\Java\src\com\epicgames\unreal

which is needed to build for android sdk 34+ and above, the issue seems to be the unreal engine 5.0.3 doesnt recognize the symbol, i dont have enough experience to pinpoint the exact issue, but i heard it could be occur from many places.

however this works for later engine versions, just for 5.0.3 it throws a little erroar.

after trying many methods including:

public static final int RECEIVER_EXPORTED = 0;

IntentFilter filter = new IntentFilter(Intent.ACTION_RUN);
registerReceiver(consoleCmdReceiver, filter, RECEIVER_EXPORTED);

i seemed to still get crash regardless of build success, it seems the issue might be in the ndk for this one. need to do more tests to see.

great news, fixed it, just comment out the segment in GameActivity.java.tempalte in the engine folder:

folder: UE_5.0\Engine\Build\Android\Java\src\com\epicgames\unreal

/*
@Override
public void onStart()
{
super.onStart();

	if (!BuildConfiguration.equals("Shipping"))
	{
		// Create console command broadcast listener
		Log.debug( "Creating console command broadcast listener");
		consoleCmdReceiver = new ConsoleCmdReceiver(this);
		//registerReceiver(consoleCmdReceiver, new IntentFilter(Intent.ACTION_RUN));
		registerReceiver(consoleCmdReceiver, new IntentFilter(Intent.ACTION_RUN), RECEIVER_EXPORTED);
	}

//$${gameActivityOnStartAdditions}$$
Log.debug(“==================================> Inside onStart function in GameActivity”);
}
*/

your done. running 19 sdk to 35 in unreal 5.0.3, im so glad the fix was so simple, thankfully i really didnt wanna update who engine

1 Like

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