android ndk 音频,Android ndk示例原生音频错误

我尝试使用OpenSl ES的示例代码,它包含在Android Studio中的NDK中。 它不起作用,因为您稍后会看到。所以我需要帮助来使用Android Studio中的代码。该代码是为Eclipse编写的,但我使用Android Studio的导入功能来包含它。我试了一下还Eclipse和它工作得很好,但尝试运行Android Studio中的代码,我得到的时候下面的错误代码Android ndk示例原生音频错误

/home/flex/AndroidStudioProjects/native-audio1/app/src/main/jni/native-audio-jni.c

Error:(155) undefined reference to `slCreateEngine'

Error:(165) undefined reference to `SL_IID_ENGINE'

Error:(165) undefined reference to `SL_IID_ENGINE'

Error:(170) undefined reference to `SL_IID_ENVIRONMENTALREVERB'

Error:(170) undefined reference to `SL_IID_ENVIRONMENTALREVERB'

Error:(215) undefined reference to `SL_IID_BUFFERQUEUE'

Error:(215) undefined reference to `SL_IID_EFFECTSEND'

Error:(215) undefined reference to `SL_IID_VOLUME'

Error:(215) undefined reference to `SL_IID_BUFFERQUEUE'

...

collect2: error: ld returned 1 exit status

make: *** [/home/flex/AndroidStudioProjects/native-audio1/app/build/intermediates/ndk/debug/obj/local/arm64-v8a/libnative-audio-jni.so] Error 1

Error:Execution failed for task ':app:compileDebugNdk'.

> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/home/flex/android-ndk-r10e/ndk-build'' finished with non-zero exit value 2

Information:BUILD FAILED

Information:Total time: 2.942 secs

Information:38 errors

Information:0 warnings

Information:See complete output in console

我迄今所做的: 我改变 的build.gradle(APP)以

apply plugin: 'com.android.application'

android {

compileSdkVersion 21

buildToolsVersion "21.1.2"

defaultConfig {

applicationId "com.example.nativeaudio"

minSdkVersion 19

targetSdkVersion 19

ndk {

moduleName "native-audio-jni" //I included this one

}

}

buildTypes {

release {

minifyEnabled false

proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'

}

}

}

而且对我改变local.properties到

sdk.dir=/home/flex/Android/Sdk

ndk.dir=/home/flex/android-ndk-r10e

我Android.mk看起来像这样

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE := native-audio-jni

LOCAL_SRC_FILES := native-audio-jni.c

# for native audio

LOCAL_LDLIBS += -lOpenSLES

# for logging

LOCAL_LDLIBS += -llog

# for native asset manager

LOCAL_LDLIBS += -landroid

include $(BUILD_SHARED_LIBRARY)

我apllication.mk:

APP_ABI := all

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值