android-ndk

NDK support with different Product Flavour

北慕城南 提交于 2019-12-29 07:42:20
问题 I want different string value from ndk library. as i have two flavor demo and live I want value "hello I am from demo " for demo flavor and for live flavor i want "hello I am from live " Here is my java file code public class MainActivity extends AppCompatActivity { // Used to load the 'native-lib' library on application startup. static { System.loadLibrary("native-lib"); } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R

What is JNI Graphics or how to use it?

烈酒焚心 提交于 2019-12-29 07:31:18
问题 In the Android NDK there is a library named JNI Graphics. What is that? Can I use that to load Images for OpenGL ES with C/C++? 回答1: The jnigraphics library can be used to access bitmap buffers in C/C++ from the android.bitmap.Graphics class (in Java, of course). It's briefly mentioned in the NDK documentation, as well as the bitmap.h header docs. It can be used to load images for e.g. OpenGL ES in C/C++, but you have to do some work to hand a jobject to that library so it can give you direct

How to automate the DDMS snapshot mechanism?

情到浓时终转凉″ 提交于 2019-12-29 07:09:04
问题 Does Android DDMS provide APIs ? I need to automate the snapshot mechanism for the native heap. Or is there any post processing tool for analysis DDMS native heap snapshots. 回答1: I assume by snapshot you mean a heap dump. From your app code you can call Debug.dumpHprofData() to dump the data. From a script you can call adb shell am dumpheap <process> <file> where <process> is e.g. your process id or name, and <file> is the dump file name. After that you can adb pull the dump to your computer.

Android SQLite R-Tree - How to install module?

烂漫一生 提交于 2019-12-29 06:26:14
问题 http://www.sqlite.org/rtree.html says that the r*tree is "included as part of the amalgamation but is disabled by default" and to enable it "simply compile with the SQLITE_ENABLE_RTREE C-preprocessor macro defined" Well I want to use R-trees in my android app, but clearly SQLite is all pre-installed etc. Is there a way to enable it on a user's phone/device? Alternatively, is it possible to use the NDK and the freely available source code for SQLite? 回答1: You can absolutely compile your own

android get screen size via C

这一生的挚爱 提交于 2019-12-28 22:27:43
问题 i want to get screen size via c. i know that jni support calling java from c. but is there any person who knows another method? i mean get screen size from lowlevel modules without calling java. import android.app.Activity; import android.os.Bundle; import android.util.Log; import android.view.Menu; public class MainActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.v("getWidth", Integer.toString(getWindowManager()

How can I effectively debug C code that's wrapped with JNI in Eclipse? (Android Dev)

天涯浪子 提交于 2019-12-28 08:39:42
问题 I've got a segfault but I have absolutely no idea how to locate it. Tips? 回答1: You can get the location of the C function that caused the crash using the Android NDK Stacktrace Analyzer. The steps are on the wiki, but basically you need to get the stack trace from logcat into a file ( adb logcat > mycrash.log ), then dump your library to a text file, then run the program on the two of them. Here's the shell script I use to do the lot: #!/bin/sh if test $# -lt 2 ; then echo "Extract readable

How can I integrate OpenCV 4.0 into a pure C++ Android NDK project?

試著忘記壹切 提交于 2019-12-28 06:50:57
问题 What are the steps necessary for me to integrate, the latest version of OpenCV into a pure C++(No Java Code) Android NDK project, such as Android NDK Google tutorial: Endless-Tunnel ? official documentation for android integration refers to much older version :OpenCV-2.4 and folder structures are no longer the same. I am using Android Studio on Linux. All help is highly Appreciated. 回答1: Download opencv Android package (e.g. opencv-4.0.1-android-sdk) and unpack to, say, ~/android . To the

How can I integrate OpenCV 4.0 into a pure C++ Android NDK project?

强颜欢笑 提交于 2019-12-28 06:50:11
问题 What are the steps necessary for me to integrate, the latest version of OpenCV into a pure C++(No Java Code) Android NDK project, such as Android NDK Google tutorial: Endless-Tunnel ? official documentation for android integration refers to much older version :OpenCV-2.4 and folder structures are no longer the same. I am using Android Studio on Linux. All help is highly Appreciated. 回答1: Download opencv Android package (e.g. opencv-4.0.1-android-sdk) and unpack to, say, ~/android . To the

multiple (my and 3rd-party) native libraries in Android NDK

蹲街弑〆低调 提交于 2019-12-28 06:36:07
问题 I have to use two native libraries: one is my own and the other one is 3rd-party. As long as I used them in separate projects, everything was ok. But now I'm getting the Exception Ljava/lang/UnsatisfiedLinkError . I'm using Eclipse. I found out that if I place the existing library in libs/armeabi, Eclipse begins compilation of the native code and it fails. If I rebuild the JNI part from the command line, compilation succeeds but the 3rd party library disappears. Really stupid. So how do I

multiple (my and 3rd-party) native libraries in Android NDK

冷暖自知 提交于 2019-12-28 06:36:04
问题 I have to use two native libraries: one is my own and the other one is 3rd-party. As long as I used them in separate projects, everything was ok. But now I'm getting the Exception Ljava/lang/UnsatisfiedLinkError . I'm using Eclipse. I found out that if I place the existing library in libs/armeabi, Eclipse begins compilation of the native code and it fails. If I rebuild the JNI part from the command line, compilation succeeds but the 3rd party library disappears. Really stupid. So how do I