Skip to content

Issues with Build Tools

Samuel Audet edited this page Aug 5, 2016 · 1 revision

Introduction

The JavaCPP Presets were designed with Maven in mind and push the limits of what is achievable within its constraints. Although other build systems such as sbt or Gradle generally work well with artifacts and repositories made for Maven, this is not always the case and can lead to unexpected behavior. This page is meant to collect in one place solutions to issues that might arise when using build tools other than Maven.

Gradle

Gradle does not support Maven profiles very well, and even when it does, it resolves the dependencies incorrectly. If you get errors such as Could not find javacpp-presets-Linux-amd64.jar or Could not find javacpp-presets-${os.name}-${os.arch}.jar please add the following lines to your build.gradle file:

configurations {
    all*.exclude group: 'org.bytedeco', module: 'javacpp-presets'
}

Because of issues like this one, we are getting rid of profiles used at runtime. In the meantime, please post a bug report to let the developers of Gradle know that Maven profiles should be properly supported.

Android Studio

Under some circumstances, Android Studio will not bundle the native libraries as part of the final APK, leading to java.lang.UnsatisfiedLinkError at runtime. To work around this, we need to copy manually the *.so files found in the JAR files. The ones zipped inside files whose names end with *-android-arm.jar should be copied to app/src/main/jniLibs/armeabi/ and app/src/main/jniLibs/armeabi-v7a/, while the ones from *-android-x86.jar files need to be placed under app/src/main/jniLibs/x86/.

Again, please make your voice heard and file a bug report to let the developers at Google know that a version of Android Studio that works properly with JNI would make your job easier.


If you encounter any other weird problems when trying to incorporate the JavaCPP Presets to your project files, please open a new issue. Maybe we will need to update this page! Thank you for your time.