0

我正在尝试集成 soundtouch 库以更改 wav 音频文件的音高和播放速率。但是当我将它添加到项目中时,会出现一个错误,如下所示

信息:Gradle tasks [:app:assembleDebug] /home/qwork/Android/android-ndk-r17/build/core/init.mk Error:(537) * Android NDK: Aborting... . 停止。错误:(537) * 错误:(537) *** 信息:BUILD FAILED 信息:总时间:14.586 秒 信息:3 个错误 信息:0 个警告 信息:查看控制台中的完整输出

请帮我解决这个问题。

4

1 回答 1

1

将以前的项目转换为最新的 Android Studio 项目的一般步骤

  1. 配置 Android Studio 以使用最新的 SDK 和NDK

  2. 使用 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属性

对于这个 SoundTouch 项目,将其迁移到原始 repo 中的 gradle build 是正确的方法。

希望这可以帮助。

于 2018-09-20T12:31:47.697 回答