Blog of Veikko M.O.T. Nyfors, Hybrid Quantum ICT consultant

Quantum Mechanics demystified, a try


Project maintained by veikkonyfors Hosted on GitHub Pages — Theme by mattgraham


R Module

Have been wondering how the resources in res xml files get to be usable in kotlin code. Answer is R module.

R module gets generated by Android Studio (as well as other IDEs like Eclipse) whenever you change something in res folder or rebuild app for a reason or another otherwise.
Essential information to be referenced from Kotlin and Java apps is contained nowadays (Android Studio Chipmunk | 2021.2.1) in

./app/build/intermediates/compile_and_runtime_not_namespaced_r_class_jar/debug/R.jar ./app/build/intermediates/runtime_symbol_list/debug/R.txt

In the old days there seem to have been an alternate approach with R.java generated and compiled instead. That must have been in namespace android.R, whereas current implementation has R in app’s own namespace, like fi.viware.remeter_tabbedactivity.R.
With android.R available in R.java, one had to import it to one’s own app, whereas nowadays one must not import android.R any more. As you can see in Problem with unresolved resource references. Resource references are nowadays in app’s own default namespace.