在Android Studio项目中集成soundtouch库

时间:2018-09-18 10:53:33

标签: android pitch-shifting soundtouch

我正在尝试集成soundtouch库,以改变wav音频文件的音高和播放速率。但是,当我将其添加到项目中时,就会出现错误提示

Information:Gradle任务[:app:assembleDebug] /home/qwork/Android/android-ndk-r17/build/core/init.mk 错误:(537) * Android NDK:正在中止...。停止。 错误:(537)* 错误:(537)*** 信息:建立失败 信息:总时间:14.586秒 信息:3个错误 信息:0警告 信息:在控制台中查看完整的输出

请帮助我解决此问题。

1 个答案:

答案 0 :(得分:0)

将以前的项目转换为最新的Android Studio项目的常规步骤

  1. 配置Android Studio以使用最新的SDK和NDK
  2. Convert(使用Android Studio):“文件”>“导入”或“欢迎页面”>“导入项目”;允许Android Studio下载该项目所需的软件包。
  3. 将现有的Android.mk/Application.mk添加到新生成的app / build.gradle

    android {
    ... // other autogenerated things, no need to change
    defaultConfig {
        ...
        // manually add your existing Application.mk with relative path to the
        // directory where THIS build.gradle is. Normally it could be
        // src/main/cpp/Application.mk as the build.gradle is at "app" dir.
        // Note that the configure items inside Application.mk could all be
        // directly set in "arguments" here ( "APP_STL=c++_static" etc)
        externalNativeBuild.ndkBuild {
            arguments "NDK_APPLICATION= src/main/cpp/Application.mk"
        }
    }
    
    // connect to the existing project's ndk-build build file, android.mk;
    // again, with the path that is relative to THIS build.gradle file's location.
    externalNativeBuild {
        ndkBuild {
            path 'src/main/cpp/Android.mk'
        }
    }
    
  4. 链接相关的源代码模块:打开Android.mk,检查该模块的所有源文件,所有相关的模块仍位于正确的位置;如果不是,请更改Android.mk中的路径或将其复制到所需的位置。这是因为转换工具无法处理依赖的源文件和模块。

  5. 最后进行构建:构建>构建APK(执行两次)

    这应该使您处于一个良好的位置。另一个有用的事情可能是sourceSet property,它允许您更改项目的默认目录

对于此SoundTouch项目,原始回购中的migrating it to gradle build是正确的方法。

希望这会有所帮助。