0

I found this on GitHub which is a wrapper for the great SoundTouch C++ library.

I'm completely new to NDK though, so would any of you kindly explain to me how to set it up correctly?

I downloaded the zip from GitHub and copied the directories into my existing project. Still, it couldn't find the native C++ functions.

I tried compiling the library using ndk-build but I got two errors. This is my terminal log:

Android NDK: APP_PLATFORM not set. Defaulting to minimum supported version android-14.    
Android NDK: WARNING:/home/daniele/AndroidStudioProjects/Chords2/app/jni/Android.mk:soundtouch: non-system libraries in linker flags: -lgcc    
Android NDK:     This is likely to result in incorrect builds. Try using LOCAL_STATIC_LIBRARIES    
Android NDK:     or LOCAL_SHARED_LIBRARIES instead to list the library dependencies of the    
Android NDK:     current module    
Android NDK: WARNING:/home/daniele/AndroidStudioProjects/Chords2/app/jni/Android.mk:soundtouch: non-system libraries in linker flags: -lgcc    
Android NDK:     This is likely to result in incorrect builds. Try using LOCAL_STATIC_LIBRARIES    
Android NDK:     or LOCAL_SHARED_LIBRARIES instead to list the library dependencies of the    
Android NDK:     current module    
[armeabi-v7a] Compile++ thumb: soundtouch <= soundtouch-jni.cpp
[armeabi-v7a] Compile++ thumb: soundtouch <= AAFilter.cpp
[armeabi-v7a] Compile++ thumb: soundtouch <= FIFOSampleBuffer.cpp
[armeabi-v7a] Compile++ thumb: soundtouch <= FIRFilter.cpp
[armeabi-v7a] Compile++ thumb: soundtouch <= cpu_detect_x86.cpp
[armeabi-v7a] Compile++ thumb: soundtouch <= RateTransposer.cpp
[armeabi-v7a] Compile++ thumb: soundtouch <= SoundTouch.cpp
[armeabi-v7a] Compile++ thumb: soundtouch <= TDStretch.cpp
[armeabi-v7a] Compile++ thumb: soundtouch <= BPMDetect.cpp
[armeabi-v7a] Compile++ thumb: soundtouch <= PeakFinder.cpp
[armeabi-v7a] SharedLibrary  : libsoundtouch.so
[armeabi-v7a] Install        : libsoundtouch.so => libs/armeabi-v7a/libsoundtouch.so
[armeabi] Compile++ thumb: soundtouch <= soundtouch-jni.cpp
/home/daniele/AndroidStudioProjects/Chords2/app/jni/soundtouch-jni.cpp:133:2: error: 
      no matching function for call to 'convertInput16'
        convertInput16(ar, fBufferIn, BUFF_SIZE);
        ^~~~~~~~~~~~~~
/home/daniele/AndroidStudioProjects/Chords2/app/jni/soundtouch-jni.cpp:58:13: note: 
      candidate function not viable: no known conversion from
      'soundtouch::SAMPLETYPE *' (aka 'short *') to 'float *' for 2nd argument
static void convertInput16(jbyte*, float*, int);
            ^
/home/daniele/AndroidStudioProjects/Chords2/app/jni/soundtouch-jni.cpp:210:16: error: 
      no matching function for call to 'write'
                processed += write(fBufferIn, fBufferOut, nSamples * cha...
                             ^~~~~
/home/daniele/AndroidStudioProjects/Chords2/app/jni/soundtouch-jni.cpp:56:12: note: 
      candidate function not viable: no known conversion from
      'soundtouch::SAMPLETYPE *' (aka 'short *') to 'const float *' for 1st
      argument
static int write(const float*, queue<signed char>*, int, int);
           ^
2 errors generated.
make: *** [/home/daniele/AndroidStudioProjects/Chords2/app/obj/local/armeabi/objs/soundtouch/soundtouch-jni.o] Error 1

2 Answers 2

1

hi you must compile library.
I suggest you use:
Linux ubuntu
NDK 14rb
First update your Linux with the following commands

sudo apt-get update
sudo apt-get upgrade

Set NDK Environment Variable:

export ANDROID_NDK=~/Desktop/ndk-folder
export NDK_ROOT=$ANDROID_NDK
export PATH=${PATH}:${ANDROID_NDK}

Then open the terminal and go to the jni folder in the project folder.
To compile the library just enter the following command:

ndk-build

enter image description here

Sign up to request clarification or add additional context in comments.

9 Comments

Thanks for the answer, I should have mentioned it before. I'm on linux. Should the ndk-build command be followed from something else?
by linux terminal you can send ndk-build command (before it, you must set ndk Environment Variables)
sorry for keeping asking. But how do I do it? If I try to run ndk-build I get a command not found error
If I downloaded the NDK directly from Android Studio, where will I find it?
in sdk folder may called ndk-bundle
|
1

Use NDK 14 only. NDK 15 and 16 aren't good enough to use for NDK building. They have got issues. Get it from https://developer.android.com/ndk/downloads/older_releases.html and in Project Setting change to the extracted location of NDK 14. It will resolve the issues related to NDK.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.