Fileaccess.open is not creating new file on android

Godot Version

4.1.3

Question

I’m trying to save scores as json. For each score my game should create a .save file in the res://data/ folder. On my windows PC it’s working properly but on my google pixel 8 I can’t create a new file with the FileAccess class. One problem ist, that the empty data folder doesn’t get exported but even if I try to save the score in the res:// folder, the file doesn’t get created:

var new_game = FileAccess.open(“res://test.save”, FileAccess.WRITE)
print(new_game)

mobile: <Object#null>
pc: <FileAccess#-9223371997898079028>

Is there any workaround or are there any settings to solve this problem?

I don’t think you should save in res://, it’s better to save in user:// maybe that’s an android restriction.

This works fine for me on my android phone, not even a warning.

const PATH_PROGRESS = "user://savegame_progress.save"

func save_data(value):
	var file = FileAccess.open(PATH_PROGRESS , FileAccess.WRITE)
	var val = var_to_str(value)
	file.store_var(val)
	file.close()

func load_data():
	var value = null
	if (FileAccess.file_exists(PATH_PROGRESS )):
		var file = FileAccess.open(PATH_PROGRESS , FileAccess.READ)
		var val = file.get_var(false)
		value = str_to_var(val)
		file.close()
	return value