Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android fails to read any json files #67855

Open
SF-Jake opened this issue Oct 24, 2022 · 1 comment
Open

Android fails to read any json files #67855

SF-Jake opened this issue Oct 24, 2022 · 1 comment

Comments

@SF-Jake
Copy link

SF-Jake commented Oct 24, 2022

Godot version

4.0.dev

System information

Windows 11

Issue description

Godot Version: Godot 4 Beta-3
When doing the following to read a JSON file it all works within the editor and PC but when exported to Android it fails to read the JSON files. I imported everything from the JSON into the dictionary that it's supposed to import the information into and the code works completely fine. I have already gone to the Export presets, set it to export all resources, and put "*.json" in the filters.

var mine_buildings := {}
var mines_file := FileAccess.open("res://resources/buildables/mines.json", FileAccess.READ)`
var mines_json = JSON.parse_string(mines_file.get_as_text())
	for mine in mines_json:
		var data = {}
		data.id = int(mine.id)
		data.output = int(mine.output)
		data.cost = int(mine.cost)
		data.color = mine.color
		data.name = mine.name
		Data.mine_buildings[data.id] = data

Left is the code working fine right is my android phone displaying a zero meaning the JSON could not be read.
image

Steps to reproduce

  1. Create a mini system to read the JSON file like show in the code above.
  2. Then just have a Label text and set it to show the length of the new dictionary "mine_buildings".
  3. When exporting to Android it will show no length of the list but 0.
  4. when running on the editor it works fine with no issues what so ever.
    Or just use the zip below and it will show the issue just run on both pc and android

Minimal reproduction project

Temp.zip

@Calinou
Copy link
Member

Calinou commented Oct 24, 2022

Related to #67630 (possible duplicate?).

JSON files are considered resources now, so putting them in the non-resource export filter won't work anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants