I use a Java library that has a .xml file embedded, and uses this in the code using
Library.class.getResourceAsStream("file.xml").
When I build with eclipse, everything goes fine. When I build with ant (without proguard), the resource can’t be found when running the app.
After some searching it turns out that the .xml file didn’t got added to the bin/classes folder. So I added a copy action after the javac command in the build.xml file.
<copy todir="${out.classes.absolute.dir}">
<fileset dir="${lib_src}/src" includes="**/*.xml" />
</copy>
This works, in the sense that the xml files are now present in the classes folder. However, they do not get included in the final apk package.
What is going wrong here? Which build-action do I need to modify?
I solved this issue by making the library android-only, not generic java. I added the xml file in the
resourcesdir, I think it was in therawdir or thexmldir. Then I used the standard android way to get those resources.