Hack and Explore :-)

Menu

Trying to add XMP packet into image in Android built with Android Studio

So working with XMP and Android is a huge problem. First there are the build issues. XMP doesn’t play well with Android Studio and the Gradle build system. Even after using this particular repo that was successful in building the XMP toolkit within Android Studio, and after using these and these instructions, I still had problems successfully building the project.

Added the following lines in my Android.mk files to avoid some random errors:

LOCAL_MODULE_FILENAME := libXMP

LOCAL_MODULE_FILENAME := xmp-jni

This is only start and all goes downhill from here.

After getting the whole project to build finally and making a small app to test it out using the JNI code from this repo, I encountered a problem with file permissions.

The library itself is called and linked properly into the app but when it comes to adding the info to the image, the library responds with the error code 112. The documentation says that this is a file permission error.

Even after declaring write permissions in the Android manifest, and using the File classes’ setWritable method and setting it to true, it did not make a difference.

After looking around on the web I read that you may actually need root permissions to get this done with XMP.

Considering all of this headache there is no way any other developer is going to use a library that is dependant on such a sloppily put together toolkit.