Android JNI static and dynamic injection methods

Author: MiniCode One of the more popular ways for Android to call C/C++ code is through JNI. There are two ways to implement local methods: static and dynamic Create a C project or C Module: After successful creation, the following files (CMakeLists.txt, nativelib.cpp) will be generated: Among them: CMakeLists file is used to package cpp […]

The first IDE developed by AOSP in history (supports Java/Kotlin/C++/Jni/Native/Shell/Python)

ASFP Study The first IDE developed by AOSP in history (supports Java/Kotlin/C++/Jni/Native/Shell/Python) Similar to Android Studio, it can be used to develop Android system source code. Android studio for platform, referred to as asfp (Falling in Love with a Rich Woman). Background & amp;Download & amp;Use Background Because the Android system source code is too […]

Android JNI (Java Native Interface) technology (used in conjunction with NDK (Native Development Kit)) Java interacts with C++, and Java calls the C++ interface

What is the interaction between Java and C++ (or other languages)? Under what circumstances is jni needed? “Interaction between Java and C++” refers to the fact that the two languages can call each other’s methods and operate each other’s data. For example, you can call C++ functions in Java code, and you can also call […]

Android JNI calling process

Article directory Preface 1. What is JNI? 2. Advantages and Disadvantages of JNI 3. JNI development process Java calls C++ function 1. Create a Java project that declares the native method, loads the dynamic library of the native function, and generates the .h file. 2. Create a C project that implements C functions and compile […]

JNI function Hook actual combat

Jni function hook All the content mentioned in this article is open source, JniHook During development, we should have seen many kinds of black technology hooks, such as got/plt hook, inline hook, etc. Thanks to the development of these technologies, we have also set out to deeper areas in the field of performance optimization. Looking […]

Correctly release JNI objects in JNI development

Get string Error?: Not released correctly, causing memory leaks const char *str = env->GetStringUTFChars(jstr, nullptr); Correct?: ReleaseStringUTFChars must be called to release const char *str = env->GetStringUTFChars(jstr, nullptr); // TODO use str env->ReleaseStringUTFChars(jstr, str); Error?: Can no longer be used after Release const char *str = env->GetStringUTFChars(jstr, nullptr); env->ReleaseStringUTFChars(jstr, str); // TODO use str Correct?: […]

ffmpeg-android studio creates jni project

1. Create native project 1.1. Select Native C++ 1.2. Naming the project name 1.3. Choose C++ standard 1.4. Project structure 1.5, app’s build.gradle plugins {<!– –> id ‘com.android.application’ } android {<!– –> compileSdk 32 defaultConfig {<!– –> applicationId “com.anniljing.ffmpegnative” minSdk 25 targetSdk 32 versionCode 1 versionName “1.0” testInstrumentationRunner “androidx.test.runner.AndroidJUnitRunner” externalNativeBuild {<!– –> cmake {<!– –> […]

One article to understand Android JNI C/C++ access Java properties and methods

boolean jboolean byte jbyte char jchar short jshort int jint long jlong float jfloat double jdouble void void String jstring Object jobject Array, array of basic data types byte[] jByteArray object array object[](String[]) jobjectArray Attribute signature Data type signature boolean Z byte B char C short S int I long L float F double D […]

OpenCV (1): Android studio jni configuration OpenCV (valid for personal testing, nanny level)

Table of Contents 1. Download OpenCV SDK 2. Create Android Native C++ project 3. Import the OpenCV project into the Android project 4. Import the OpenCV library file 5. Implement demo of opencv Gaussian blur image processing To configure C++ methods using the OpenCV library in Android Studio, you need to complete the following steps: […]