Can someone please explain to me how Resource id generation is going to work now with AARs.
Incorporating APKLIBs was slow but fairly straight forward. I have just spent the last 48 hours trying to get the android-maven-plugin to build an APK that depends on an AAR that has code referencing it own resources. As part of that I have spent a large chunk of time trawling through the android platform tools source and it's not clear to me that all use cases have been covered.
So I hoping that someone can clarify a raft of questions that surfaced as part of my investigations for which I couldn't find any doco.
- /AndroidManifest.xml (mandatory)
- /classes.jar (mandatory)
- /res/ (mandatory)
- /R.txt (mandatory)
In my APK that consumes this AAR I will presumably also have resources.
Q1: What should happen when there is a name clash between the AAR and APK for those resources? Eg
- AAR/res/layout/layout_main.xml vs APK/res/layout/layout_main.xml
- AAR/res/values/strings.xml vs APK/res/values/strings.xml
- AAR/res/values/strings_a.xml (string1) vs APK/res/values/string_b.xml (string1)
Should the build break in any/all 3 cases?
Q2: Does/Should AAR classes.jar contain a compiled R class.
If it has non-final fields then how are those fields updated to reflect the the values generated during the APK build.
If they are not updated then how are id clashes from more than one dependent AARs prevented?
Q4: If the AAR R class either doesn't exist or has final fields then the final values will have been burnt into the compiled classes that use them.
During he APK build when the resource ids are generated for all the resource contained in the APK (including the AAR resources), how are the references in compiled classes updated?
William