I am trying to implement aes_ctr128_encrypt in android using BoringSSL as defined by google.
I built the application with CMAKE and Gninja by following the link
https://boringssl.googlesource.com/boringssl/+/master/BUILDING.md
Now I have crypto and ssl folders in the build folder but there is no AES definition in any of the files as AES.h was in the include folder in root directory.
Anyhow, The binaries thus generated with CMAKE are also giving .a files and not .so files. How can I use those .a files in my project to access the aes_ctr_128_encrypt?
Related
For Intellij (and Android Studio) I built a JNI shared library that links to boost libraries that I'd link to include in my Android app. I called System.loadLibrary on my .so file but it fails to find boost libraries when I run it. I get the following error:
java.lang.UnsatisfiedLinkError: dlopen failed: library "libboost_unit_test_framework-clang-mt-x32-1_77.so.1.77.0" not found: needed by /data/app/~~28p8gv9ihFbZAejYd9c9yw==/sensoft.applications.dt1demo-0IEJ8o6cHOk0kputNbnbNQ==/base.apk!/lib/x86/libssi_utils_java.so in namespace classloader-namespace
Even though the boost .so files are there in the libs/x86 directory (I built them in x86 with the android toolchain to run on my emulator) but it did manage to find the .so file that I built in the same directory.
I placed my .so file and all the required boost .so files in the libs/x86 directory and included the following as a jni source in my build.gradle file:
sourceSets {
main.jniLibs.srcDirs = ['libs']
}
But my application can't seem to find the boost shared libraries specifically.
Android's install process will not extract libraries that don't have the suffix .so. You have to remove the version suffix of the library (which serves no purpose on Android anyway, because libraries are not all installed to a single common path).
I am trying to build multiple .so libraries which must be included as separate libraries in the APKs 'lib' folder. How do I accomplish that using cmake and gradle?
in firebase crashlytics we see no stacktrace for native crash
How do we include symbol files?
Below is my guess on how to proceed..
build NDK from source and generate *.so files. They are typically generated under obj or libs folder.
find the path of the *.so files
direct crashlytics to upload those symbols using firebaseCrashlytics directive in build.gradle (https://firebase.google.com/docs/crashlytics/ndk-reports)
I'm not sure if my assumption is correct, if it is.. How do I do #1? build NDK?
I can see that react-native can generate those *.so files when I build react-native from source files. (such as libc++_shared.so)
I guess we need to do the same thing as RN is doing.
I am new to Android Studio. I am using Android Studio 1.3 because it has built in NDK support. I have a project that can be used as an application or as a library project. When I imported it to Android Studio as an application (and modified the gradle scipts as documented), it built the .so files and included them in the .apk output. When I modified it to be a library project, it is building the .so files, but not including them in the .aar output and hence they are missing in the final .apk. Should I have to do anything to inform it to put the .so files into the .aar? If so, what should I do?
Are you building your .so files by calling ndk-build or by using the gradle or gradle-experimental plugin ?
If your .so files are already built, you can just drop them inside src/main/jniLibs/ folders and they should get included into the .aar as well as the APK.
I have been trying to implement the API for the serial port found the the below web page. I am a beginner in all this and I am sure about what I am looking at:
http://code.google.com/p/android-serialport-api/source/browse/#svn%2Ftrunk%2Fandroid-serialport-api%2Fproject%2Fjni
Questions:
1) The .c files are built how? Do I need to download the NDK? I assume the .c file is run directly by the virtual machine, or what? Or is the executable for the .c the file in the libs directory? If so, how do I utilize the libserial_por.so file?
Thanks!
The .c files are built into a library by running ndk-build in the project directory. You need the NDK.
The .c files are not run directly by the virtual machine, but rather a library is created in the libs directory, which is then loaded along with the SerialPort class.
To use the library, just use the SerialPort class which already has bindings to the library.
C files will be compiled to an ARM binary library with the extension .so by the NDK. Take a look at the NDK Documentation, section "Getting Started with the NDK", to find out how to use it.
Basically, you place your .c files in the jni directory, change Android.mk to specify how to compile them, then run ndk-build to build the library. The resulting lib<name>.so will be placed in the lib directory. You then use your library in the Java project with System.loadLibrary('<name>').
This of course means the library must have a JNI interface for you to be able to use with the Java application, since Android doesn't support JNA yet.
I see though that the code you pointed out is an Android project. To run it, simply run ndk-build in the project directory to build the library, then run the project in an emulator.