0

I am trying to integrate soundtouch library for change in pitch and playback rate of wav audio file. But when i add it in the project the an error arising which is given belo

Information:Gradle tasks [:app:assembleDebug] /home/qwork/Android/android-ndk-r17/build/core/init.mk Error:(537) * Android NDK: Aborting... . Stop. Error:(537) * Error:(537) *** Information:BUILD FAILED Information:Total time: 14.586 secs Information:3 errors Information:0 warnings Information:See complete output in console

Please help me for resolve this issue.

  • how are you doing it? – Gerry Sep 18 '18 at 14:40
  • first i integrate ndk in android studio then import the native source code for audio file pitching and set playback speed from this url https://gitlab.com/soundtouch/soundtouch and follow the process for integrate this library which is given from that url. – parikshit tiwari Sep 19 '18 at 06:00
  • For Android project, the top level is gradle build scripts; C/C++ modules built via adding hooks ( CMake or ndk-build ) into the gradle scripts. Open Android Studio, Create a new project with the given template and enable the C/C++, when it completes, build and run it; then add your soundtounch to your app/build.gradle file. – Gerry Sep 19 '18 at 07:22
  • I create the new project but my question is how to integrate that library in app/build.gradle, i mean put it inside jni or cpp folder or only gradle file. I don't understand the importing process of this library. – parikshit tiwari Sep 19 '18 at 08:07
  • Maybe check the merge request: https://gitlab.com/soundtouch/soundtouch/merge_requests. It should work -- use Android Studio's "open existing project" option, and explore and point it to build.gradle – Gerry Sep 19 '18 at 11:53
  • It support now on Android studio but the app module not contain so the sample project inside soundtouch library is not running and show this error Gradle 'Android-lib' project refresh failed Error:Expected caller to ensure valid ABI: MIPS – parikshit tiwari Sep 19 '18 at 12:27
  • NDK does not support MIPS anymore, could you download the latest Android studio ( 3.1.4 ), it should not ask for MIPS anymore. also do a git clean -xdf to make sure get fresh code ( mainly about .externalNativeBuild dir ) – Gerry Sep 19 '18 at 12:38
  • I download the latest Android studio (3.1.4). But when integrate soundtouch required folders inside cpp folder and make changes in native-lib then these issues occurring :- Build command failed. Error while executing process /home/qwork/Android/Sdk/cmake/3.6.4111459/bin/cmake with arguments {--build /home/qwork/Documents/FirstWallNew/app/.externalNativeBuild/cmake/debug/armeabi-v7a --target native-lib} [1/2] Building CXX object CMakeFiles/native-lib.dir/src/main/cpp/native-lib.cpp.o [2/2] Linking CXX shared library ../../.././build/intermediates/cmake/debug/obj/armeabi-v7a/libnative-lib.so – parikshit tiwari Sep 20 '18 at 11:46
  • for this one, do not use CMake: you already have ndk-build method, just use that. Android studio supports it. They are enabled at relatively the same time. Make sure you SDK and NDK is configured for your android studio, my merge_request should work. Or add a local.properties to your top level directory to set up sdk.dir = your-sdk-location and ndk.dir=ndk-location ( it will do the same thing ) – Gerry Sep 20 '18 at 12:35

1 Answers1

1

General steps to converting previous projects to the latest Android Studio projects

  1. Configure Android Studio to use the latest SDK and NDK

  2. Convert with Android Studio: file > import or "welcome page" > "Import project"; allow Android studio to download needed packages for this project.

  3. Adding your existing Android.mk/Application.mk to your newly generated 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. Linking dependent source code modules: open Android.mk, check all source files for this module and all dependent modules are still in the right location; if not, change the path in Android.mk or copy them into the required place. This is because the converting tool does not handle dependent source files and modules.

  5. Finally do a build: build > build APK ( do it twice )

    This should get you to a good position. Another useful thing might be the sourceSet property which allow you to change project's default directories

For this SoundTouch project, migrating it to gradle build in the original repo is the right approach.

Hope this helps.

Community
  • 1
  • 1
Gerry
  • 1,223
  • 9
  • 17