Android Source Build process: Adding resources like properties file to APK

Recently i have been cuddling with OpenCV for android, I have been trying to  put something like SmartStay feature in Galaxy S3 into my Galaxy Note. I was pretty much successfull and i have decided to add this to my JellyBean Build. Unfortunately it didn’t work. When i checked the difference between the apk generated from eclipse build and android rom build, i found that eclipse build is smarter than the big brother in case of building an apk. Some of the libraries (jar files) i was using contained some properties files in it. When eclipse packed APK it will extract the properties files and put them   in the root of the apk. In the case of android source build mechanism it took only the class files dexed them. As a result the app failed to load properties file.

Solution to my issue was to modify android Package build. Download and apply the patch on the build project on android source tree

create directory in the Application project folder in the same level as ‘src’ and ‘res’ called ‘myresource’.  Copy all the properties files need for the application in to directory. Modify the add an extra variable LOCAL_X_JAVA_RESOURCE_DIR to the you additional resource directory