问题
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.
回答1:
General steps to converting previous projects to the latest Android Studio projects
- Configure Android Studio to use the latest SDK and NDK
- Convert with Android Studio: file > import or "welcome page" > "Import project"; allow Android studio to download needed packages for this project.
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' } }
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.
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.
来源:https://stackoverflow.com/questions/52384948/integrate-soundtouch-library-in-android-studio-project