I don't know how to use .so files in my project. So I downloaded the ffmpeg.so file and now I need to add it to my solution so that I can convert video formats on my device but I do not know how. I tried finding tutorials on the internet on how to add this file but nothing seems to work for me.
Do I still need the Android NDK to compile my C code as I have the .so file.
Any good tutorials how I can add this library to my solution?
Put the file named libffmpeg.so into libs/armeabi subdirectory of your project. You don't need NDK if you don't have C/C++ sources of your own.
A mistake that happen sometimes is that the Android name expectations are not met. The name must start with lib and end with .so.
Related
I inherited an Android project which includes a sub-project to build a JNI library from C source. I want to remove the C source and include pre-built library instead. Based on tips I found here and there, I copied the .so files from the .apk to paths like:
app/src/main/jniLibs/armeabi-v7a/libxcore.so
But, when I tried to build the app I get "cannot find symbol" errors for classes defined in the library. I'm guessing I need to add something to build.gradle that points to the .so files, but am very new to Java/Android/Gradle and can't figure out what. Tried a variety of things suggested here, with no luck. Thanks for any help.
The error had nothing to do with the location of the .so files, but with the fact that the library sub-project I deleted also contained some Java sources. Once I added back the original library project, and deleted only the C sources, everything worked fine.
I found some modified code in a cpp file in android to protect smartphone from stagefright vulnerability.
I want to change it with original cpp file and rebuild to a new android ROM file.
The problem is,
I downloaded an android factory image from google developer forum and
I unpacked it with android kitchen tool.
Now I can see its contents but I couldnt find the file, I wanted to modify, "/media/libstagefright/MPEGExtractor.cpp".
There are only some .so files in system/lib/ folders.
I heard it's almost impossible to decompile those .so files.
I tried googling to find out which .so files have "MPEGExtractor.cpp", so that I would be able to compile some files including that cpp file into a .so file, and change it, and rebuild it a new ROM.. but I couldn't find out.
What should I do to rebuild it with some code to be changed?
Thank you for reading
SO(Shared Object) are files that are compiled from source. By definition they do not contain the symbol information you are asking for.
In the android-gif-drawable lib source, it doesn't contain any Andorid.mk or Application.mk file, as the result when I use the ndk-build, it returns some error like this
Please define the NDK_PROJECT_PATH variable to point to it
I am really poor in ndk, is there anyone could help me?
You may wonder why I need to build the so file, the reason is that: in my project, I already have another .so file lib, it seems that when I use the gradle to add the gif lib(compile 'pl.droidsonroids.gif:android-gif-drawable:1.1.6') my another ".so" file can't be found, and my app error.
So I now try to build the gif lib to a ".so" file, I hope this way could be help.
The inclusion of android-gif-drawable shouldn't lead to the removal of your other .so files. Can you post your current build.gradle file ?
Amyway, you can directly get android-gif-drawable .so files from the jni folder that is inside the lib's .aar: https://bintray.com/artifact/download/koral/maven/pl/droidsonroids/gif/android-gif-drawable/1.1.6/android-gif-drawable-1.1.6.aar
Else, in orer to rebuild it yourself, you can can clone the github repo and build it using gradle. If you want to use the ndk-build command, you'll have to write the Makefiles.
I cannot get the Conceal Library to work, it may be something I am doing wrong, I wish the instructions were a bit more detailed.
http://facebook.github.io/conceal/documentation/
I have added the crypto.jar to my project, and then the instructions tell me to add the files armeabi/*.so to my jni folder.
"Add a dependency to crypto.jar from java code using your favorite dependency management system, and drop the .so files in libs.zip into your jni/ folder."
I don't have a jni folder, since my project is a normal Android progect, not an NDK project. How can I get this to work, I tried creating the folder and adding it to the build path, but it did not work. I am completely lost on this. In my source code I am loading the libraries like this:
static {
// Load Facebook Conceal Crypto Files
System.loadLibrary("libconceal.so");
System.loadLibrary("libcryptox.so");
}
then the instructions tell me to add the files armeabi/*.so to my jni folder.
That's a bug in their documentation. Pre-compiled .so files will go in libs/. So, you should wind up with libs/armeabi/*.so.
I tried creating the folder and adding it to the build path
That is almost never the right answer and can seriously screw things up, so I recommend that you reverse that step.
I have a .o file for a 3rd party library. I do not have the .c files for it, nor can I get access to them. Normally this isn't a problem, I would just add this to the list of files to link in. But I can't find a way to link in a file without compiling it in the NDK without altering the build scripts. Any suggestions?
I found an answer. Pain in the neck, but it works. I had to turn my .o file into a .a file via the program ar, then create a new static module in my Android.mk file to turn it into a library that android could link via LOCAL_STATIC_LIBS.