I have an android project with several build goals (using ant). For testing purposes, all created targets have different package names (so my package name is com.mycompany.myapp for build release and com.mycompany.myapp.test for build test).
This works for the most part, except when it comes to custom xml namespaces in layout files. So:
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:custom="http://schemas.android.com/apk/res/com.mycompany.myapp" />
will stop working as soon as the package name is replaced by com.mycompany.myapp.test.
Because of this, I have to change the value of com.mycompany.myapp every time during the preliminary build. And since all these files should be in vcs and should not conflict every time one person switches the configuration and they are combined, I had to move the layout files to a specific configuration folder, where they would look like this:
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:custom="http://schemas.android.com/apk/res/@CONFIG.PACKAGENAME@" />
Now these files are stored in vcs, and @ CONFIG.PACKAGENAME @ is replaced during pre-build, and then the file is copied from. /config/file.xml in. / res / layout / file.xml.
This is extremely inconvenient and does not scale very well (I cannot imagine how to mention each of the 50 files in the build script).
So my question is: is there a way to automatically use the current package name in a namespace declaration? Or at least modife layout files (or build files?), So I donβt have to replace com.mycompany.myapp every time the package name changes.
android android-layout xml ant
Alexey May 4 '12 at 11:32 2012-05-04 11:32
source share