GithubHelp home page GithubHelp logo

Comments (7)

aaandreyev avatar aaandreyev commented on May 24, 2024 1

wow, thank you, and especially for the prebuilt library. It's working like a charm now.

from android-imagemagick7.

MolotovCherry avatar MolotovCherry commented on May 24, 2024

Your UnsatisfiedLinkError is happening because it requires a library, but none is being found. The file magick you used and renamed into a .so library is an arm64-v8a elf binary, not a library. You need to build the project from source to get a static library file. You can do this using a standard ndk build as referenced in Android docs. The rest of the specific gradle support files to build it can be found in libjmagick-7/android/app.

  1. Build the library as per instructions above. After you set up NDK as per Android requirements, you can run the bat file in the jni directory to make a build. Then place your library in the app\libs\arch folder (replace arch with appropriate arch, usually arm64-v8a and build your application). Android will add the library to the apk/lib folder, which will be recognized in the system path, and the java code will see the library.

  2. You need to build the library. See above. The library should be named libjmagick-7.so

  3. Some of the delegates use C++ coding instead of C. In Android, C++ requires a special C++ support library. If you don't compile the C++ delegates, this library is not needed. No dynamic loading is needed, all the java and everything works out of the box once you set everything up. Also, if you build it yourself, just delete the prepackaged libc++shared.so file. Your build will generate one for you. Use that one. -> The reason it is there is because the magick binary is linked against it.

The whole directory is pre-configured to use a binary, not a library. Given that everybody's needs are different, it didn't make sense for me to build the library and upload it anymore (the delegates are easily configurable in the mk files).

If you absolutely must, there's a library in the releases section. I don't suggest using it though as it's an older version. -> NOTE: This does not include libjmagick-7.so. You must build the project to get this file.

Also, last thing. I don't think you should use the Java API. It is old and outdated. You should just use the binary. It is better.

from android-imagemagick7.

MolotovCherry avatar MolotovCherry commented on May 24, 2024

Anyways, I built it for you just to save time. But the instructions are above. Please do get acquainted with how Android NDK works so you can stay up to date with any future code changes.

I built it using this configuration -> NOTE: I'd suggest to use OpenCL rather than OpenMP as it's better and faster, but this requires a special configuration. You will need to build it yourself to get OpenCL support.

#----------------------------------------------------------------------------#
#                                  _           _     _                       #
#                  /\             | |         (_)   | |                      #
#                 /  \   _ __   __| |_ __ ___  _  __| |                      #
#                / /\ \ | '_ \ / _` | '__/ _ \| |/ _` |                      #
#               / ____ \| | | | (_| | | | (_) | | (_| |                      #
#              /_/    \_\_| |_|\__,_|_|  \___/|_|\__,_|                      #
#                                                                            #
#  _____                            __  __             _      _      ______  #
# |_   _|                          |  \/  |           (_)    | |    |____  | #
#   | |  _ __ ___   __ _  __ _  ___| \  / | __ _  __ _ _  ___| | __     / /  #
#   | | | '_ ` _ \ / _` |/ _` |/ _ \ |\/| |/ _` |/ _` | |/ __| |/ /    / /   #
#  _| |_| | | | | | (_| | (_| |  __/ |  | | (_| | (_| | | (__|   <    / /    #
# |_____|_| |_| |_|\__,_|\__, |\___|_|  |_|\__,_|\__, |_|\___|_|\_\  /_/     #
#                         __/ |                   __/ |                      #
#                        |___/                   |___/                       #
#                                                                            #
#----------------------------------------------------------------------------#

# list of supported architectures 
# https://developer.android.com/ndk/guides/application_mk.html

# mips32 have a bug with 64bit atomic counter, so if you need 
# this platform - plz, use gcc build
# DO NOT BUILD MORE THAN ONE AT THE SAME TIME, OR IT WILL FAIL
# BUILD THEM ONE AT A TIME
# armeabi-v7a is currently not supported
APP_ABI := arm64-v8a
APP_PLATFORM := android-24
NDK_TOOLCHAIN_VERSION := clang

# list of build-in STL's supported by NDK. 
# switch to clang STL in case of using this compiler
# https://developer.android.com/ndk/guides/cpp-support.html#runtimes

# Until NDK r16, the NDK's libc++ is only of beta quality. 
# Beginning with NDK r16, libc++ will be the preferred STL. 
# A future NDK release will remove the other options.
APP_STL := c++_shared

APP_CFLAGS   += -O3

APP_CPPFLAGS += -O3


#------------------------------------------
# Magick options

HDRI_ENABLE   := true
# 8, 16, 32
QUANTUM_DEPTH := 16


#------------------------------------------
# Whether to do a static or shared library
# build. Shared library builds are mandatory
# for jmagick builds.
#
# You can also choose to build a magick
# binary (NOT recommended to build a magick)
# binary when using jmagick. Because special
# paths must be set via code
#

STATIC_BUILD     := false
# magick bin requires magick wand API
BUILD_MAGICK_BIN := false
BUILD_MAGICKWAND := true


#------------------------------------------
# Types of builds available. OpenMP, OpenCL, or neither
# Neither will do a vanilla build without either feature

# openCL build requires special setup. Check the libopencl
# directory for more information
OPENCL_BUILD     := false
OPENMP_BUILD     := true


#------------------------------------------
# Enable or disable jmagick build
#
# - Enabling this will patch imagemagick for
# jmagick and android compatibility
#
# - Disabling this will compile the vanilla
# (unmodified) imagemagick source code
#
# -> If this is enabled, it will force enable
# a shared library build (because it is required)
#
# -> Requires a MagickWand build as well
#

JMAGICK_ENABLED := true


#------------------------------------------
# Enable or disable specific delegates here
#

LIBBZ2_ENABLED        := true
LIBFFTW_ENABLED       := true
LIBFREETYPE2_ENABLED  := true
LIBJPEG_TURBO_ENABLED := true
LIBLZMA_ENABLED       := true
LIBOPENJPEG_ENABLED   := true
LIBPNG_ENABLED        := true
LIBTIFF_ENABLED       := true
LIBWEBP_ENABLED       := true
LIBXML2_ENABLED       := true
LIBZLIB_ENABLED       := true
LIBLCMS2_ENABLED      := true

#------------------------------------------

# fix long windows paths causing build to fail (too many sources)
LOCAL_SHORT_COMMANDS := true
APP_SHORT_COMMANDS := true

#------------------------------------------
LOCAL_PATH := $(call my-dir)
include $(LOCAL_PATH)/make/postconfig.mk

imagemagick-7-android-staticlib-arm64v8a.zip

from android-imagemagick7.

MolotovCherry avatar MolotovCherry commented on May 24, 2024

You're welcome. Please be advised that I just updated the version to the latest now. 7.0.8-63 -> 7.0.9-16

from android-imagemagick7.

kalyani-mango avatar kalyani-mango commented on May 24, 2024

I am getting below error even though i have symbolic link created for same
imp

from android-imagemagick7.

MolotovCherry avatar MolotovCherry commented on May 24, 2024

@kalyani-mango Are you using jmagick? If you are, jmagick is now incompatible and unsupported (jmagick hasn't been updated in 4 years).

I recommend to call the binary directly, or, you can try my fresh Kotlin implementation
https://github.com/MolotovCherry/kmagick

But to put it simply, you need a special jmagick dll/so that implements the bindings to the C imagemagick library. This is the part that's unsupported

from android-imagemagick7.

MolotovCherry avatar MolotovCherry commented on May 24, 2024

No i am using ImageMagick 7.0

What is your setup? Imagemagick doesn't support Java out of the box (it's only a c library and binary), so it's impossible to get an unsatisfiedlinkerror unless you're trying to use Java bindings (with jmagick or similar libraries)

from android-imagemagick7.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.