Problem loading resources on Android

Godot Version

4.3

Question

Hello, I’m having a problem loading resources here in my project. I don’t understand why, but the code works fine on the computer, however, when I test it on my cell phone the code doesn’t work and gives an error in logcat.

This is my code that I created to get all the scenes from a directory with the keyword “heartpart” and put them inside an array to then create an instantiate of each item in the game scene:

func _create_all_heartparts() -> void:
	var directory_path:String
	var heartparts_array:Array
	var dir:DirAccess
	
	var number_level = Global.find_number_in_string(self.name)
	directory_path = "res://componets/lvls/level" + str(number_level) + "/"
	dir = DirAccess.open(directory_path)
	
	
	#Carregar cada cena HeartPart e adiciona a um array
	print("Directory level " + str(number_level))
	if not dir.list_dir_begin() == OK:
		printerr("Error listing files in this directory.")
		return
	
	if dir:
		while true:
			var file_name = dir.get_next()
			
			if not file_name == "": print("File found: ", file_name)
			else: print("End of directory."); break
			
			if file_name.find("heartpart") != -1 && not dir.current_is_dir() && (file_name.ends_with(".tscn") || file_name.ends_with(".tscn.remap")):
				var file_path = directory_path + file_name
				var scene = ResourceLoader.load(file_path)
				heartparts_array.append(scene)
			
			
			if file_name.find("areas_collision") != -1 && not dir.current_is_dir() && (file_name.ends_with(".tscn") || file_name.ends_with(".tscn.remap")):
				var file_path = directory_path + file_name
				print(file_path)
				var scene = ResourceLoader.load(file_path)
				
				var data_component = scene.instantiate()
				heartarea_node.add_child(data_component)
	
	dir.list_dir_end()
	
	print("\n", "Array with all heart parts loaded: ",heartparts_array, "\n")

As I said, this code works fine on my computer, however, when I test it on my cell phone the same thing doesn’t happen! I like creating games, but I’m almost giving up on everything because it’s very difficult to move forward.

If anyone knows what’s going on I would appreciate it.