ndk | android ndk jni module for use internal libs android | Android library
kandi X-RAY | ndk Summary
kandi X-RAY | ndk Summary
android ndk jni module for use internal libs android from source code.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of ndk
ndk Key Features
ndk Examples and Code Snippets
Community Discussions
Trending Discussions on ndk
QUESTION
I tried to compile a .so library using Visual Studio 2019 along with OpenCV Android in order to use this library in Unity. There are some answers on how to configure Visual Studio to use OpenCV Android (here or here) but none of these work for me. Below you can see my configurations.
Visual Studio 2019 (running on Windows 10)
android-ndk-r21e // also tried with android-ndk-r15c android-ndk-r16b and android-ndk-r17c
OpenCV Android 4.5.2 // also tried with OpenCV Android 4.0.0, 4.0.1 and 4.1.0
My settings in Visual Studio 2019 look as follows:
Configuration Properties
- General
Platform Toolset Clang 5.0 (also tried Clang 3.8 or GCC 4.9)
Configuration Type Dynamic Library (.so)
Target API Level Nougat 7.0 (android-24) (also tried different versions)
Use STL LLVM libc++ static library (c++_static) (also tried "GNU STL static library (gnustl_static)")
C/C++
- General
Additional Include Directories "Path to OpenCV_4_5_2_Android\sdk\native\jni\include"
Code Generation Enable C++ Exceptions "Yes(-fexceptions)"
Language C++17(-std=c++1z)
Precompiled Headers Not using Precompiled Headers
Linker
- General
- Additional Library Directories Path to OpenCV_4_5_2_Android\sdk\native\libs\armeabi-v7a
- Input
- Additional Dependencies Path to OpenCV_4_5_2_Android\sdk\native\libs\armeabi-v7a\libopencv_java4.so
My Source.cpp I try to compile is just a single function for testing purposes
...ANSWER
Answered 2021-Jun-10 at 16:27I had the exact same issue as you (though I used c++ 11) with the exact same setup, and struggled for days. I believe the errors you're seeing (like me) are from arm_neon.h. Very oddly, I was able to just build (not run) the .so successfully, even with those errors (I say "errors" because if you look at arm_neon.h, others pop up), so try it. Maybe it's some kind of IntelliJ/Intellisense mistake more than anything else where it's catching false negatives from some other toolchain setup.
At the same time, I'm not 100% sure I was always able to build with that issue, so try these steps as well if you can't:
- use OpenCV 4.0.1 with Android NDK 16rb. The NDK matters when it comes to OpenCV builds, and this is the only supposed match that I know of.
- follow this tutorial from scratch: https://amin-ahmadi.com/2019/06/03/how-to-use-opencv-in-unity-for-android/
- if the downloaded OpenCV android SDK is still giving trouble, build OpenCV from the source using his other tutorial here: https://amin-ahmadi.com/2019/02/03/how-to-build-opencv-4-x-for-native-android-development/ and then repeat step 2.
MAJOR EDIT: OpenCV 4.5.2 needs to be treated differently because it no longer uses toolchains with gnu c++. -When you build OpenCV from CMake, build with Android NDK 21e, and do not use the toolchain in OpenCV 4.5.2. Use the one inside the Android NDK's build folder (android-ndk-r21e\build\cmake). -When you build your .so from Visual Studio 2019, do not use the GNU STL, use the LLVM. GNU c++ is no longer part of Android NDKs, and you need to cut it out of the process entirely. -In the Linker Input, put the names of your library files (or file, if it's just the world one) in the Library Dependencies field, not the Additional Dependencies field. -Everything else is the same as in those common tutorials.
QUESTION
error :
ANSWER
Answered 2021-Jun-07 at 21:04This is a bug in version 6.0.0 of the Google Mobile Ads Unity plugin. Tracked in https://github.com/googleads/googleads-mobile-unity/issues/1613.
QUESTION
I have an Android CMakeList.txt that defines multiple target libararies (static and dynamic). For one of these libraries I need to pass the -Wl,--version-script with a specific version script, to achieve this I'm using target_link_libraries:
...ANSWER
Answered 2021-Jun-07 at 19:09I assume the option is treated as PUBLIC
here. In general I recommend always specifying the "visibility" when using target_***
commands.
In this case I'd recommend using target_link_options
though, since this states the intention more clearly.
QUESTION
I successfully compiled boost 1.70
for Android armeabiv7a
with NDK r21b
.
I used user-config.jam:
...ANSWER
Answered 2021-Jun-07 at 07:22By looking where a "ld.exe" was present in C:\Android\android_sdk\ndk-bundle\toolchains\llvm
folder, I found some under C:\Android\r21a_Qt5_14\android_sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\\bin
so I concluded that target platform was probably missing.
I added:
QUESTION
When building a flutter app, I get an error stating
...ANSWER
Answered 2021-May-27 at 08:33I got that error on React Native 0.64 app on AppCenter build for Android.
The solution is to go to android/app/build.gradle
file and comment ndk { debugSymbolLevel 'FULL' }
line if you have so (defaultConfig { ndk { debugSymbolLevel } }
)
The solution was found by my colleague Jose, so all credits to him)
QUESTION
Hello I am beginner in Android NDK programming and I need some help getting freetype library to work with my project. I've been trying for 3 hours straight to somehow import freetype to my Android Studio project. I searched on the internet and could not find any solution that was working. I downloaded the library and put it in my cpp folder of the project.But I don't know how to include freetype. Any help would be appreaciated!
This is how my CMakeLists.txt look and for the files that I have added it works for them:
...ANSWER
Answered 2021-May-21 at 19:31Ok the solution was very simple. All I did actually was I created directory in cpp folder named freetype and in that dir I've put every freetype file and just added that folder as sub directory in CMake and linked at the end and now eveyrthing works. Here is my CMake:
QUESTION
I've already seen this question whose answers are way too broad for my case. Clearly this is a Cmakelists.txt only related problem.
I'm trying to integrate a dynamic (.so) native library with an existing Android Application with JNI support.
So basically, this project already includes a shared native library that would use other shared native libraries. In my case it is called libcardios and it will be invoked from native-lib.cpp.
I guess I have a CMakeLists.txt issue here because the linker command simply does not include the reference to my shared library:
...ANSWER
Answered 2021-May-19 at 11:59Like with any other libraries, created using add_library
, linking with the IMPORTED library is performed using its name, without dereferencing it.
Dereference (${...}
) is applied to a variable, but add_library
creates a target, not a variable.
QUESTION
I have a Flutter app in production on the Google Play store, which includes a native dynamic library built using the NDK and loaded at runtime (I have called it libraster.so
). On most devices this library is present and loads fine. But on certain devices, the following ArgumentError
occurs at runtime Invalid argument(s): Failed to load dynamic library (dlopen failed: library "libraster.so" not found)
.
The devices in question are ARM devices I believe. The app doesn't specify any abiFilter
in the app module's build.gradle
file.
Using Google Play Console's App Bundle Explorer, I can download the APKs that would be distributed to the affected devices, and they contain libraster.so
as normal.
According to my error logs, the device which are affected so far are:
Model Name Android version SM-G928F Samsung Galaxy S6 Edge+ 6.0.1 SM-J500M Samsung Galaxy J5 6.0.1 SM-J710GN Samsung Galaxy J7 2016 6.0.1 SM-T110 Samsung Galaxy Tab 3 Lite 7.0 4.2.2 SM-T111M Samsung Galaxy Tab 3 Lite 7.0 4.2.2 GT-I8262 Samsung Galaxy Core Duos 4.1.2 GT-I8552 Samsung Galaxy Win Duos 4.1.2 GT-I8552B Samsung Galaxy Win Duos 4.1.2 GT-I9082L Samsung Galaxy Grand Duos 4.2.2 GT-I9300 Samsung Galaxy S III 4.1.2 GT-N8000 Samsung Galaxy Note 10.1 4.1.2 GT-N8010 Samsung Galaxy Note 10.1 4.1.2 GT-P3110 Samsung Galaxy Tab 2 7.0 4.1.2 GT-P5110 Samsung Galaxy Tab 2 10.1 4.2.2 SO-03E Sony Xperia Tablet Z 4.1.2 B1-A71 Acer Iconia Tab B1-A71 4.1.2 F-01F Fujitsu Arrows NX F-01F 4.2.2 ME173X Asus Memo Pad HD7 4.2.2Mostly Android 4.1.2, 4.2.2 and 6.0.1 devices.
Here's a simplified version of my app module's build.gradle
:
ANSWER
Answered 2021-Mar-08 at 13:01A similar issue was reported here: https://github.com/simolus3/moor/issues/895
The suggested fix was for this case to create a Flutter plugin which calls System.loadLibrary()
QUESTION
Note: Although question is duplicate, but current answers lacks details, so I wanted to post another one.
I'm using C++Builder developed by Embarcadero.
For Windows, it compiles fine.
For Android, it shows the following error:
...ANSWER
Answered 2021-May-17 at 14:10my bet is that you need to use "Preprocessor directives" in your code and indicate platforms
QUESTION
I'm trying to run my Flutter app on my phone, connected via USB, in order to debug.
It stopped working from one day (May 13, if it matters) to the next. Quite frustrating is that I made no changes since it last worked. Since the last time I clicked the Android Studio "play" button on May 13, there were only code changes, which all ran fine via hot reload. Then the next day when pressing the play button, it suddenly complains about JAVA_HOME not being set.
After some troubleshooting, I now get the error message
...ANSWER
Answered 2021-May-15 at 11:31Delete .gradle folder and .idea folder from the project root folder
In Android Studio, File -> Invalid cache and restart
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install ndk
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page