Android Ndk - Gradle Build Error
Solution 1:
I see you have problems building libsoundtouch.so
in Android Studio. This happens, e.g. when the build scripts of a third-part library require special environment. E.g. the only supported way to build webrtc for Android is on 64-bit Linux.
In this case, you can use the prebuilt libraries. Put them in a jniLibs
folder under your project (jniLibs/armeabi-v7a/libsoundtouch.so
etc.), or set a custom folder for jniLibs
in build.gradle (in android {} block):
sourceSets.main.jniLibs.srcDir 'libs'
You should not use externalNativeBuild.ndkBuild.path together with this.
Solution 2:
You should setup your gradle project to build the C++ library.
Please add to your build.gradle the following line (inside the android {} block):
externalNativeBuild.ndkBuild.path = 'jni/Android.mk'
(assuming paths ~/AndroidStudioProjects/Chords2/app/build.gradle and ~/AndroidStudioProjects/Chords2/app/jni/Android.mk).
To reduce compilation time and APK size, you can filter out the ABIs that you don't use, at least while debugging:
ndk { abiFilters 'armeabi-v7a' }
This line goes inside the defaultConfig {} block.
At any rate, after the APK is ready, you can use Build/Analyze APK from Android Studio's menu and check that all .so files are packed into it.
Post a Comment for "Android Ndk - Gradle Build Error"