### Godot version

v4.2.rc2.official 

### System information

macOS Sonoma 14.0  - Mac Mini Apple M1 - Godot v4.2.rc2.official 

### Issue description

Testing the new system for Android plugins I found this bug when I tried to export the demo for Android using the **[Hello World plugin](https://github.com/m4gr3d/Godot-Android-Samples/blob/master/plugins/hello_world/README.md)** 

If I select the Gradle Build with **Export Format**:  **Export APK** it works. But when I change it to **Export AAB** Godot displays an error and then crashes, as mentioned in @https://github.com/godotengine/godot/issues/76497



### Steps to reproduce

Clone the project Godot-Android-Samples from:
`https://github.com/m4gr3d/Godot-Android-Samples.git` (commit 09386ad)

Build the  Hello World plugin: 

Using terminal go to 
`cd Godot-Android-Samples`

Run the gradlew command
`./gradlew :plugins:hello_world:assemble`

Using Godot v4.2.rc2, import the demo Godot project for Hello World plugin from:
`plugins/hello_world/demo`

If you haven't already installed the Android Build Template for Godot v4.2.rc2, install it.

Make sure the plugin is enabled 

> Project->Project Settings..-> Plugins

**HelloWorldPlugin** status Enable (checked)

Go to 

> `Project->Export`


Confirm that Android is already defined in Preset and select **Android (Runnable)**

Confirm **Use Gradle Build:** is On

Set **Export Format:** to **Export AAB**

In **Export Path** set the file extension with aab


![Screenshot 2023-11-26 at 15 08 45](https://github.com/godotengine/godot/assets/9322152/fc7664c5-2493-41a7-8c43-137dc1743d81)



Select **Export All...** and then **Debug**

Wait for the build to complete and check for the 'Build FAILED' message and Godot crashing.


The error only occurs with the 'Export AAB' option, not with the 'Export APK' option.

### Minimal reproduction project

[Godot-Android-Samples-master.zip](https://github.com/godotengine/godot/files/13467705/Godot-Android-Samples-master.zip)
}
	}
	notification(NOTIFICATION_WM_SIZE_CHANGED);
	if (embedder) {
		embedder->_sub_window_update(this);
	}
}
void Window::_update_window_callbacks() {
	DisplayServer::get_singleton()->window_set_rect_changed_callback(callable_mp(this, &Window::_rect_changed_callback), window_id);
	DisplayServer::get_singleton()->window_set_window_event_callback(callable_mp(this, &Window::_event_callback), window_id);
	DisplayServer::get_singleton()->window_set_input_event_callback(callable_mp(this, &Window::_window_input), window_id);
	DisplayServer::get_singleton()->window_set_input_text_callback(callable_mp(this, &Window::_window_input_text), window_id);
	DisplayServer::get_singleton()->window_set_drop_files_callback(callable_mp(this, &Window::_window_drop_files), window_id);
}
Viewport *Window::get_embedder() const {
	ERR_READ_THREAD_GUARD_V(nullptr);
	Viewport *vp = get_parent_viewport();
	while (vp) {
		if (vp->is_embedding_subwindows()) {
			return vp;
		}
		if (vp->get_parent()) {
			vp = vp->get_parent()->get_viewport();
		} else {
			vp = nullptr;
		}
	}
	return nullptr;
}
void Window::_notification(int p_what) {