android-ndk

Where is Android.mk supposed to be?

[亡魂溺海] 提交于 2020-05-25 17:09:50
问题 In the documentation for Android NDK, the following statement is present: The Android.mk file resides in a subdirectory of your project's jni/ directory [...] http://developer.android.com/ndk/guides/android_mk.html I can interpret from this that an Android.mk file should be placed in [project_path]/jni/[module_name]/Android.mk , each module having its own specific Android.mk file since this is what differentiates it from the application wide Application.mk file, but when I execute ndk-build I

Passing byte array from native code to the Java side

流过昼夜 提交于 2020-05-25 04:19:30
问题 My goal is passing a byte array of variable length from native code to Java side. The Java class instance method takes bytearray as its argument: private void writeBuffer(final byte[] buffer) { } I am able to find a method ID in the native code: jclass cls = (*env)->FindClass(env,"class_path"); jmethodID writeBufferMethodID = (*env)->GetMethodID(env, cls, "writeBuffer", "([B)V"); But still can't figure out how to pass a byte array properly. I have tried: jbyteArray retArray = (*env)-

Passing byte array from native code to the Java side

試著忘記壹切 提交于 2020-05-25 04:18:53
问题 My goal is passing a byte array of variable length from native code to Java side. The Java class instance method takes bytearray as its argument: private void writeBuffer(final byte[] buffer) { } I am able to find a method ID in the native code: jclass cls = (*env)->FindClass(env,"class_path"); jmethodID writeBufferMethodID = (*env)->GetMethodID(env, cls, "writeBuffer", "([B)V"); But still can't figure out how to pass a byte array properly. I have tried: jbyteArray retArray = (*env)-

Passing byte array from native code to the Java side

六月ゝ 毕业季﹏ 提交于 2020-05-25 04:17:36
问题 My goal is passing a byte array of variable length from native code to Java side. The Java class instance method takes bytearray as its argument: private void writeBuffer(final byte[] buffer) { } I am able to find a method ID in the native code: jclass cls = (*env)->FindClass(env,"class_path"); jmethodID writeBufferMethodID = (*env)->GetMethodID(env, cls, "writeBuffer", "([B)V"); But still can't figure out how to pass a byte array properly. I have tried: jbyteArray retArray = (*env)-

When I build ffmpeg with ndk it does not create .so and .a files for libavresample and libpostproc

柔情痞子 提交于 2020-05-17 08:53:27
问题 When I build ndk with ffmpeg it does not create .so and .a files for libavresample and libpostproc . I build ffmpeg with this files. But , it does not create .so and .a files for libavresample and libpostproc . How can I build .so and .a files for libavresample and libpostproc ? 回答1: Do you really need libavresample and libpostproc? I doubt it. libavresample - a deprecated alternative to the native libswresample, an audio resampling library. It is not enabled by default. If you want it then

imread works in a normal c++ program, but not in android with ndk native

给你一囗甜甜゛ 提交于 2020-05-17 08:49:18
问题 #include <jni.h> #include <string> #include <opencv2/opencv.hpp> using namespace cv; #include <iostream> extern "C" JNIEXPORT jstring JNICALL Java_com_example_cppinandroid_MainActivity_stringFromJNI( JNIEnv* env, jobject) { Mat image; image = imread( "/home/<name>/a.png", 1 ); if ( !image.data ) { return env->NewStringUTF( "No data in image!" ); } else { return env->NewStringUTF( "Data is in image" ); } } That's what I have in Native Cpp part of the android project. When I run the application

How to resolve so file mapping in eclipse project aosp android

喜欢而已 提交于 2020-05-17 06:55:06
问题 I am working in aosp 9 where I migrated the entire Browser app from 6 to 9. I have librawrapper.so which is available in jni/armv7-a/ folder. This project is eclipse and hence I am not able to edit in gradle. So it has only mk file. LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) SODIR=armv7-a LOCAL_MODULE_CLASS := SHARED_LIBRARIES LOCAL_MODULE_TAGS := optional LOCAL_PRELINK_MODULE := false LOCAL_MODULE := librawrapper.so LOCAL_SRC_FILES := $(SODIR)/librawrapper.so LOCAL_SHARED_LIBRARIES :

JNI “undefined reference” to c++ method

耗尽温柔 提交于 2020-05-17 05:48:07
问题 I'm trying to create poker app with JNI in android studio, I want to save one instance of c++ class (TexasHoldem) and invoke it's methods only. in the texasJNI.java I wrote: public class jniTexasHoldem { private long texasHoldm; jniTexasHoldem() { ConstructNativeTexas(); } // Used to load the 'native-lib' library on application startup. static { System.loadLibrary("native-lib"); } /** * A native method that is implemented by the 'native-lib' native library, * which is packaged with this

Android Studio CMake - shared library missing libc++_shared.so? Can CMake bundle this?

隐身守侯 提交于 2020-05-11 04:30:06
问题 Now that Android Studio 2.2 is released officially, I'm migrating from my old ndk-build process to try and use CMake within AS. As I'm incorporating several codebases from within my company (that I can't edit) that make heavy use of C++11 code (including the dreaded std::to_string() method), the only way I can compile is with a select few configuration options - all of which I discovered earlier when beginning work with ndk-build. (see below) So everything compiles again and builds into the