projectM-visualizer / examples-android

Sample Android app that integrates projectM and visualizes audio on mobile devices. NOTE: This is NOT the Android app found in the Play Store! Please refer to the README for details.
GNU Lesser General Public License v2.1
7 stars 2 forks source link

Android arm64 build #2

Open gsus24 opened 3 years ago

gsus24 commented 3 years ago

Can´t get it work on 64bit. Building the library without error and installed it successfully on device, but get error when opening the app.

I edit ./configure-ndk like suggested https://developer.android.com/ndk/guides/other_build_systems

#!/bin/bash

if [ -z ${NDK+x} ]; then
  export NDK=${HOME}/Android/Sdk/ndk-bundle;
fi

export HOST_TAG=linux-x86_64
export TOOLCHAIN=$NDK/toolchains/llvm/prebuilt/$HOST_TAG
export TARGET=aarch64-linux-android
export API=22
export AR=$TOOLCHAIN/bin/llvm-ar
export CC=$TOOLCHAIN/bin/$TARGET$API-clang
export AS=$CC
export CXX=$TOOLCHAIN/bin/$TARGET$API-clang++
export LD=$TOOLCHAIN/bin/ld
export RANLIB=$TOOLCHAIN/bin/llvm-ranlib
export STRIP=$TOOLCHAIN/bin/llvm-strip

export LIBS_NDK=$NDK/sources/third_party/vulkan/src/build-android/jniLibs/
export CPPFLAGS="-march=armv8-a -I$LIBS_NDK -fPIC"
export GL_LIBS="-lGLESv3 -lEGL"

./configure --host $TARGET \
    --enable-gles --disable-static --disable-sdl --disable-qt \
    --prefix=`realpath src/projectm-android/app/jniLibs` \
    --libdir='${exec_prefix}/arm64-v8a' \
    --datarootdir=`realpath src/projectm-android/app/src/main/assets`

Add the library to my project edited CMakelists and build.gradle to arm64-8va. I can install the app but running into error dlopen: library not found

What i am doing wrong? Hope there is somebody know how to get it work. Thanks

kblaschke commented 3 years ago

Could you try buildnig projectM with the current master using the CMake scripts?

Recent Android NDKs ship with a CMake toolchain file and information about how to build projects with it.

gsus24 commented 1 year ago

Hi Kai, another try to build for arm64. In the android-example you use precompiled library. Do you mean building it completly in Android Studio?

Is it enough to copy the folder projectm/src/libprojectM to my project and change cmake path in build.gradle to the new one?

Could you please explain on how you would do it? Without help, i am lost

kblaschke commented 1 year ago

If the project builds libprojectM properly then, it may work. Setting the include directories can be challenging.

I'd still recommend building it separately with the proper Android NDK for your target platform, then point CMAKE_PREFIX_PATH to the install dir and use CMake's find_package(libprojectM) command to integrate it into you project.