android-ndk

Add a static library (.a file) to an Android project with CMake, get “CMake Error: CMake can not determine linker language for target”

那年仲夏 提交于 2021-01-28 03:50:25
问题 I generate the static library from another Android project, so pretty sure they're useable. I got four .a files based on CPU architectures, one .h file which also has been tested. Now in new project, another .c file want to call the static library, i can't combine the two projects, the static libraries must be called in .a format. I got "CMake Error: CMake can not determine linker language for target", this is my CMakeLists.txt: add_library( mylib STATIC src/main/jniLibs/arm64-v8a/libmylib.a

Android native code fork() has issues with IPC/Binder

好久不见. 提交于 2021-01-28 02:24:25
问题 I have an Android native Server app compiled as Platform privileged module that forks itself. This module also uses Android services, like SurfaceFlinger. I need to fork to have one sandboxed process per client. Fork() works fine and the parent process has no issue at all. But in the child process, when I try to access any Android service/resource I get: signal 11 (SIGSEGV), code 2 (SEGV_ACCERR), fault addr xxxxxxxx ... ... /system/lib/libbinder.so (android::Parcel::ipcSetDataReference ...

Android native code fork() has issues with IPC/Binder

ⅰ亾dé卋堺 提交于 2021-01-27 19:40:39
问题 I have an Android native Server app compiled as Platform privileged module that forks itself. This module also uses Android services, like SurfaceFlinger. I need to fork to have one sandboxed process per client. Fork() works fine and the parent process has no issue at all. But in the child process, when I try to access any Android service/resource I get: signal 11 (SIGSEGV), code 2 (SEGV_ACCERR), fault addr xxxxxxxx ... ... /system/lib/libbinder.so (android::Parcel::ipcSetDataReference ...

Call static Java method from separate thread using JNI

半世苍凉 提交于 2021-01-27 18:44:28
问题 I'm trying to use JNI in android to make a function pointer that a native library I'm using uses forward it's call to java. When initializeStateController is called, a new thread is made using pthread_create that calls the function pointer whenever the state of the State Controller changes. However, when I try to call GetStaticMethodID from state_exec in C, I'm getting the following error: JNI DETECTED ERROR IN APPLICATION: jclass is an invalid local reference: 0xec500019 (0xdead4321) in call

JNI Environment Pointer

拟墨画扇 提交于 2021-01-27 18:32:09
问题 I have a Java class in which I have a function which must be called from my C code. The function is the following: public void endTrial(){ //Code } So I have created the following code in my C file: JNIEXPORT void JNICALL package_endTrialJava(); JNIEXPORT void JNICALL package_endTrialJava(){ jobject javaObjectRef = env->NewObject(javaClassRef, javaMethodRef); env->CallVoidMethod(javaObjectRef, javaMethodRef); } But to be able to call this function with the env variable, I have created this

After migrating from SDK 28 to SDK 29 in Android my app crashed and facing : signal 11 (SIGSEGV), code 2 (SEGV_ACCERR), error in Android studio 3.4.1

给你一囗甜甜゛ 提交于 2021-01-27 17:53:09
问题 Iam facing the issue only in OnePlus, Samsung , Poco F1 with Android OS version 10. It's working in pixel devices with Android 10. Please find the error logs below Build fingerprint: 'Xiaomi/beryllium/beryllium:10/QKQ1.190828.002/V11.0.6.0.QEJMIXM:user/release-keys' Revision: '0' ABI: 'arm64' Timestamp: 2020-03-16 18:10:34+0530 pid: 2594, tid: 2737, name: JavaBridge >>> com.mymobile<<< uid: 10362 signal 11 (SIGSEGV), code 2 (SEGV_ACCERR), fault addr 0x7188e089db Cause: execute-only (no-read)

Undefined References Error OpenCv Android with ndk 18 (c++_static)

為{幸葍}努か 提交于 2021-01-27 17:30:23
问题 I updated Android Studio to use the ndk18 and changed: APP_STL := c++_static This lead to a bunch of linker errors in OpenCv: ../thirdparty/opencv-android-sdk/sdk/native/jni/../libs/arm64-v8a/libopencv_objdetect.a(detection_based_tracker.cpp.o): In function `cv::DetectionBasedTracker::updateTrackedObjects(std::vector<cv::Rect_<int>, std::allocator<cv::Rect_<int> > > const&)': detection_based_tracker.cpp:(.text._ZN2cv21DetectionBasedTracker20updateTrackedObjectsERKSt6vectorINS_5Rect_IiEESaIS3

A problem occurred configuring project ':CordovaLib'

偶尔善良 提交于 2021-01-27 12:50:44
问题 BUILD FAILED in 3s cmd: Command failed with exit code 1 Error output: FAILURE: Build failed with an exception. What went wrong: A problem occurred configuring project 'CordovaLib'. No toolchains found in the NDK toolchains folder for ABI with pref Try: Run with --stacktrace option to get the stack trace. Run with --infout . Get more help at https://help.gradle.org BUILD FAILED in 3s [ERROR] An error occurred while running subprocess Cordova. cordova build android exited with exit code 1. Re

Android.mk seems not to exist

拥有回忆 提交于 2021-01-27 10:58:30
问题 I hope I have not overseen the question was already asked or the question is to stupid... I have installed Android Studio and Android NDK following the official tutorial at http://developer.android.com/ndk/guides/index.html and I could run the simple hello-jni app on my device. In the tutorial in the following "building section" is told that "The Android.mk file resides in a subdirectory of your project's jni/" but I am absolute sure, that there is no Android.mk in my project -.- Thanks in

Securing API key using NDK

China☆狼群 提交于 2021-01-24 11:30:11
问题 I am trying to store api keys using NDK but i tried somany methods always somany error I will share my code please any body help me.. I will share my steps i followed .. 1 Create a folder “jni” under src/main 2 Create and add “Android.mk” file under “jni” folder with following content: LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) LOCAL_MODULE := keys LOCAL_SRC_FILES := keys.c include $(BUILD_SHARED_LIBRARY) Create and add “Application.mk” file under “jni” folder with the following