Added Android NDK to project and `OS independent path error`


Added Android NDK to project and `OS independent path error`
I am trying to add a Android NDK
to my project in Android Studio
. The project I am trying to add can be found here : https://github.com/timsu/android-aac-enc
Android NDK
Android Studio
I have added the JNI
folder to the root of my project and It seems to recognize it, but when I build the project I get the following error:
JNI
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:transformNativeLibsWithMergeJniLibsForDebug'.
> More than one file was found with OS independent path 'lib/armeabi-v7a/libaac-encoder.so'
I have also tried adding these lines but when using these or deleting I get 16 more errors so It seems the that the Android aac enc
is not the only thing using lib/armeabi-v7a/libaac-encoder.so
:
Android aac enc
lib/armeabi-v7a/libaac-encoder.so
android {
packagingOptions
pickFirst 'lib/armeabi-v7a/libaac-encoder.so'
pickFirst 'lib/x86/libaac-encoder.so'
If there is anything else that I need to provide then I will do so. I just do not seem to understand where this error is coming from.
I have looked in all of my folders and none of them have another libaac-encoder.so
.
libaac-encoder.so
There were no errors before I moved the JNI
folder from the project to mine.
JNI
1 Answer
1
With Android Studio v3.2 or newer, copying the JNI folder is not enough.
You should add
android externalNativeBuild ndkBuild
path 'jni/Android.mk'
My guess is when I added the
JNI
it came or created libaac-encoder.so
but my project was already using it, since when I remove it, then It gives me many more errors and now they are both trying to use their own and that gives the error, but I have no idea how to check it or fix it– kataroty
2 days ago
JNI
libaac-encoder.so
It's very hard to guess what goes wrong when you withhold important details. If you want your issue to be resolved quickly and completely, reproduce the problem in a minimal way (remove all irrelevant code as long as the issue is reproduced), and post the full failing code here or on GitHub.
– Alex Cohn
2 days ago
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
I did not mention it but I do already have that line. Is there anything else I could provide that could be of use in order for you to help me?
– kataroty
2 days ago