I cant generate the JAR file with SLC without R.java so I still require RGenerator
I see, so its not a moo point!
As the source code is Android Studio I havent got it to compile successfully in Eclipse
It shouldnt matter hugely though. I usually just create a template java project, and drag the source files into the Eclipse project/src folder and they get copied there. I wonder how it works with AS.
I think RGenerator (or some variation of it) would still be worthwhile either using my RX pattern or perhaps by altering the library source code references for R to use the BA.applicationContext.getResources() pattern instead (thus eliminating the need for R.java in the library).
You shouldnt need to alter the library source code. Basically think of this as a double re-direction.
- Your library source lets say points to "import com.sourcelibrary.R;"
- Then our R.java generated by RGenerator should have the package name "package com.sourcelibrary"
- Inside this R.java it is getting resources from BA.applicationContext.getResources().getIdentifier("md_icon_max_size", "dimen", BA.packageName), and if you look closely you will see it is getting the identifier from the B4A project packagename. Right, so it is expecting the resources under that.
- Therefore you need to compile the resources under this package name, the java packer aapt.exe will pack the resources under an R.java which is under the B4A packagename. So essentially the library R.java is indirectly referencing the main R.java to access the resources.
It depends on how you are comfortable with this flow, but i cant see another way to do it, except if you really want to specify the packagename in the AdditionalRes then you need to use the same packagename in the getIdentifier method.