build failed when using "AAudioStream" in android studio [duplicate]

I try to follow the next exemple in order to create a simple synthesizer app:
https://codelabs.developers.google.com/codelabs/making-waves-1-synth/#0

but, when I pressed Run, the Build failed.

void AudioEngine::stop() {
if (stream_ != nullptr)
{
    AAudioStream_requestStop(stream_);
    AAudioStream_close(stream_);
} }

and the error is: undefined reference to ‘AAudioStream_close’

notice that ‘AAudioStream_close’ is exists function: https://developer.android.com/ndk/reference/group/audio

If I press Ctrl+B, and the mouse on the function, I get to the source code of the function, at AAudio.h
so android studio did recognize it.

Also, stream_ is a member of AudioEngine, as one can see in AudioEngine.h:

class AudioEngine { public:
bool start();
void stop();
void restart();
void setToneOn(bool isToneOn); 
private:
Oscillator oscillator_;
AAudioStream *stream_;};

If so, what is the problem and how do I fix it?

Source: Windows Questions C++

LEAVE A COMMENT