I need to parse string resources at the project build stage. Before the aapt2, I did it like this. Now with the advent of aapt2, resources are collected in the *.arsc.flat format. Disabling apt2 is not suitable as a permanent solution. How can I parse resources in this format?
Asked
Active
Viewed 317 times
1 Answers
0
The correct way to do this would be to parse the output APK and get the symbols from it.
However, it is a lot of work and if you just want a hacky quick-fix you can instead inspect the R.txt
file that's output by the process<Variant>Resources
task. It's basically a list of all the resources in the project, including all the strings. The format is a line per resource in the form of:
<java type> <resource type> <resource name> <resource ID>
So you need to find all the lines with:
int string some_string_name <ID>

Izabela Orlowska
- 7,431
- 2
- 20
- 33