FAQ Database Discussion Community


re write-sql statement Insert OR REPLACE from java to c++ NDK Android

c++,android-ndk,android-sqlite
I need re write this sqlite Statements from java to c++, BEcouse of low performance: I red this arcticle: Improve INSERT-per-second performance of SQLite? But Iam totaly confused, becouse I cant find any sqlstatemenst of Insert or Update public synchronized void saveMatchValue(int photoRecOwner, int[] photoRecAssign, float[] value) { SQLiteDatabase database...

Project Tango Point Cloud strange crash, and dense depth map

android-ndk,google-project-tango
I am trying to use Project Tango C API, but the application crashed with no error if number of point cloud are more than ~6.5k (after some testing) with the following code int width = mImageSource->getDepthImageSize().x; int height = mImageSource->getDepthImageSize().y; double fx = mImageSource->calib.intrinsics_d.projectionParamsSimple.fx; double fy = mImageSource->calib.intrinsics_d.projectionParamsSimple.fy; double cx...

AES/CBC/PKCS5Padding different results in JAVA and JNI

java,android,encryption,android-ndk,openssl
I have a Java code for encryption which looks like this byte[] encrypt(byte[] clearData) { byte[] passwordKey = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E,0x0f}; byte[] rawSecretKey = new byte[]{0x34, (byte) 0xA4, 0x16, 0x09, 0x77, (byte) 0x85, (byte) 0xB4, 0x31, 0x75,...

Android Studio NDK return jint

android,android-ndk,jni,jint
I have successfully followed this tutorial https://www.youtube.com/watch?v=kFtxo7rr2HQ to learn about building NDK apps with Android Studio. That tutorial uses a public native String HelloJNI(); That string is set in the HelloJNI.c file #include "com_example_myapplication_MainActivity.h" /* Header for class com_example_myapplication_MainActivity */ /* * Class: com_example_myapplication_MainActivity * Method: HelloJNI * Signature: ()Ljava/lang/String;...

Since there are some different headers of arches that NDK gave, which directory should I use

android,android-ndk,header
In the path $NDK_ROOT/platforms/android-[n]/, there are some sub-directories, such arch-arm, arch-arm64, arch-mips, can I simply use the header files of arch-arm/usr/include/? If the answer is yes, and then, does the compiler replace these headers for each platforms at compile time?

How can I link cpufeatures lib for a native android library?

android,c++,gcc,android-ndk,linker
I'm trying to link android's cpu_features to a native library. I'm using android's gcc compiler directly as a cross compiler. (NOT ndk-build). I've included the header ($NDK_PATH/sources/android/cpufeatures/cpu-features.h), but i don't see a prebuilt libcpufeatures.a file anywhere under the ndk folder. How can I build that library? Or where can it...

Native Code: cannot use typeid with -fno-rtti

c++,osx,gcc,android-ndk,vtk
I'm trying to build native code on android because I want to use VTK for my android tablet. However, I am facing some issues when it comes to building one of the vtk examples. I know this problem has been covered here for an objective c issue but I guess...

Porting msvc code to Android/ios

android,c++,ios,android-ndk,porting
I have a pretty large project written in C++ for Windows, with some MSVC-specific fancy things, like __declspec(property), usage of SEH, extra template and macro flexibility, intrinsics and etc. In a nutshell it consists of various applications and a shared library (lib), which is a pretty large "algorithmic" code. It's...

Getting error: Execution failed for task : myApp:compileDebugNdk'

android,android-studio,android-ndk,cocos2d-x,cocos2d-android
Hi I am trying to run an app created with Cocos2d-x 2.5 with Android Studio but I keep getting this error when running the project: :myApp:compileDebugNdk AGPBI: {"kind":"ERROR","text":"*** Android NDK: Aborting... . Stop.","sourcePath":"/mypath/ndk/android-ndk-r10d/build/core/add-application.mk","position":{"startLine":199},"original":""} FAILED Execution failed for task ':myApp:compileDebugNdk'. Building works ok. I have Android Studio 1.1.0 and a Mac...

NDK r10 b 32 bit or 64 bit or compile using both and how to achieve it

android,android-studio,android-ndk,openvpn,ndk-build
When I ndk compile a project using r10b 64 bit builder it compiles good without any problem I am able to run the project in Lollipop succesfully and app runs as it supposed to be But when I run the project in JellyBean at runtime I get the following error...

NDK r10b 32 and 64 bit builder for mac

android,osx,android-ndk,32bit-64bit,ndk-build
Here is the link to 32 bit NDK r10b builder http://dl.google.com/android/ndk/android-ndk32-r10b-darwin-x86_64.tar.bz2 Here is the link to 64 bit NDK r10b builder http://dl.google.com/android/ndk/android-ndk32-r10b-darwin-x86_64.tar.bz2 Both the NDK builder seems to be identical and both are marked as r10b (64-bit) in RELEASE.TXT So, Am I doing downloading NDK builders from wrong place ?...

Remote debugging of pure C program with GDB

android,c,android-ndk,gdb,gdbserver
I am trying to remotely debug a pure C program on an Android device. The Android device (target) is connected via USB to a host machine. What I did was: Copied from the target the following files: /system/lib, /vendor/lib, /system/bin/app_process, and /system/bin/linker. Target: Copied gdbserver from NDK to the target...

Why does Unity fail to load android native libraries when linked against OpenCV?

android,c++,opencv,unity3d,android-ndk
The title says it all. I'm using NDK to build a native library for use with Unity (the game engine, not the Ubuntu shell). I already have much of the code in place and it works on my Xperia Z Ultra which runs Android 4.4.4. However, recently I sent the...

Can't find OpenCV headers when compiling with ndk-build

android,opencv,android-ndk,jni
When I try and ndk-build my project, I get: opencv/core/core.hpp: No such file or directory #include <opencv/core/core.hpp> ^ As far as I can see, I've got everything configured correctly: Android.mk LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) # OpenCV OPENCVROOT:= /.../ OPENCV_CAMERA_MODULES:=on OPENCV_INSTALL_MODULES:=on include ${OPENCVROOT}/sdk/native/jni/OpenCV.mk LOCAL_MODULE := native_lib LOCAL_SRC_FILES := jni_part.cpp...

Debug native code in Android Studio

android,debugging,android-studio,android-ndk
Google I/O 2015 promised debugging native code in Android Studio. To do this, you need to install ndk-bundle through SDK manager and update Android Studio to the latest version (Canary branch). And what to do next? How setup? Here is a link to the source. Source

java.lang.UnsatisfiedLinkError: Native method not found: package.ClassName.stringFromJNI:()Ljava/lang/String;

java,android,android-ndk
I am working on android application in which i am using NDK library, everything works fine on cleaning the project i got this warning: Android NDK: WARNING: APP_PLATFORM android-21 is larger than android:minSdkVersion 3 in ./AndroidManifest.xml When i went to my activity to see the result from my native code,...

OpenGL framebuffer android without GL_OES_packed_depth_stencil (on Nexus 7 2012)

android,c++,android-ndk,opengl-es-2.0,framebuffer
How do I init the framebuffer with depth and stencil on a device which does not support GL_OES_packed_depth_stencil (In my case a Nexus 7 2012)? This does not work: glGenRenderbuffers(1, &depthStencil); glBindRenderbuffer(GL_RENDERBUFFER, depthStencil); glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8_OES, width, height); glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, depthStencil); glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, depthStencil); GLenum status =...

Compile and use boost for Android NDK R10e

android,c++,boost,android-ndk
How do I compile and use Boost for the Android NDK? I've tried everything I've found online, from Boost for Android to compiling it myself with the bjam file. However, I do not succeed. When I try compiling it with bjam, I get the following error: error: toolset gcc initialization:...

What are corresponding directories on Android for common Linux pathnames?

c++,linux,android-ndk,porting,rooted-device
I'm porting the C++ myToll Linux application to run on Android using NDK r10d. (Note this is not an Android app with an apk, but a utility tool to run from the shell.) This is a command line interface and has no GUI and is being built as a standalone...

How to Compile Google stressapptest for Android x86 Phone?

android,compilation,android-ndk,cross-compiling,stress-testing
Step (1) Download Source svn checkout http://stressapptest.googlecode.com/svn/trunk/ stressapptest Step (2) How to Compile above Code for Android x86 Phone ? Answer Not available with me. Step (3) How to Install ? adb push stressapptest /data/local/tmp/ adb shell chmod 777 /data/local/tmp/stressapptest adb shell /data/local/tmp/stressapptest Step (4) How to Run ? User...

What is the difference between normal method call from native method call?

android,android-ndk
//my class class NDKSupport { // Loding library static { System.loadLibrary("NDKTest"); } // Stuff in NDKSupport public native String getMessageFromNDK(NDKSupport support); public String getMessage() { // doing some stuff over here return "SOME RESULT"; } } //Native code JNIEXPORT jstring JNICALL Java_com_afbb_ndkcheck_NDKSupport_getMessageFromNDK( JNIEnv* env, jobject thiz, jobject ndkSupport) { jclass...

Add -j 4 command to eclipse build

android,eclipse,android-ndk
I am building an android NativeActivity in eclipse using the ndk. When I do it from the command line ndk-build -j 4 it goes much faster than when I don't add -j 4. But I like how eclipse points me to compile errors in code. Is there a way I...

How to use native OpenSL ES in android studio

android,android-studio,android-ndk,opensl
I need to develop an audio app in NDK using Android Studio. I have added the ndk path to local.properties - ndk.dir=/opt/android-ndk-r10 sdk.dir=/opt/adt-bundle-linux-x86_64-20140702/sdk In build.gradle I added an entry for OpenSLES - apply plugin: 'com.android.application' android { compileSdkVersion 20 buildToolsVersion "21.1.2" defaultConfig { applicationId "com.example.hellojni" minSdkVersion 8 targetSdkVersion 21 ndk...

How do i call C/C++ code from Android using JNA?

android,c++,android-ndk,jni,jna
I'm trying to integrate this specific library to my Android project, and the library is written in C/C++. I've miraculously gotten ndk-build to give me the needed .so file. However, looking at it, there's a sample in the project, and they use a mysterious .jar with the API bindings of...

Android NDK socket creation null pointer

android,c,sockets,nullpointerexception,android-ndk
For adding TCP-socket-options, I need to use the C-sockets of Android NDK instead of Java sockets. The following function is called by a button-click-event. When creating such a socket, the syscall leads me to a null pointer (see log output at the end). As the log shows, the line above...

Problems compiling NDK project with Android Studio 1.3 preview

android,android-studio,gradle,stl,android-ndk
Decided to give the new NDK support in Android studio a shot but seem to be running into an issue: Error: 'std::function' has not been declared Had a few other linking issues with stl libraries before but those were fixed by adding stl "stlport_static" cFlags "-O2 --std=c++11 " to the...

Android Studio, LOCAL_C_INCLUDES += /foo/bar/include not working?

android,c,android-studio,android-ndk
I have an Android Studio project that uses NDK and I can't get include paths to work. let say I have app/src/main/jni/foo/bar/file.c and it includes "my/lib/inc.h" When I add LOCAL_C_INCLUDES += /home/user/include/ (to app/src/main/jni/Android.mk) where the folder "my" is located I still get file not found from ndk-build If I...

How to make android NDK work in windows?

android-ndk,windows-7-x64
I have downloaded android-ndk-r10e & I have also setted path in environment variable as well as NDK path for eclipse. I was able to build and run HelloJni sample app from eclipse, but when I use console to build it says 'ndk' is not recognized as an internal or external...

Android C++ Minimalist sample app: "Cannot find module with tag 'gpg-cpp-sdk/android' in import path

android,c++,android-ndk
So, I'm trying to compile the Minimalist sample code from this tutorial. https://developers.google.com/games/services/cpp/gettingStartedAndroid I have Android SDK and NDK and gpg-cpp sdk installed at C:/Android, and environmental variables set. so, to my knowledge I've followed the guide to the letter. But when I run ndk-build inside the jni folder I...

Android NDK error bash: ../../build/intermediates/classes/debug/: Is a director

android,android-ndk
ubuntu kylin system NDK version r10e SDK version android-22 Details command: javah -d jni -classpath /home/king/ide/android-sdk-linux/platforms/android-22/android.jar;../../build/intermediates/classes/debug/ com.lengking.ndk.MainActivity error :bash: ../../build/intermediates/classes/debug/: Is a director I did not find the answer on the Web

How to fix 'javah' error when using NDK with Android Studio?

android-studio,sdk,android-ndk
I am trying to set up NDK so that I can add C/C++ code to my Android application within Android Studio 0.5.1. I am ultimately trying to get it compiled during gradle build, and to properly handle APKs generation. Much like the tutorial explains in this video: https://www.youtube.com/watch?v=okLKfxfbz40 . My...

Android (ART) crash with error JNI DETECTED ERROR IN APPLICATION: jarray is an invalid stack indirect reference table or invalid reference

java,android,android-ndk,jni,leptonica
I am writing an Android application that processes a picture from the native C (NDK r10d). The code was working well until recent ART introduction that is more strict with JNI. So the code is working fine with Dalvik (e.g. on pre-Lolipop devices) but ii creates a SIGENV on...

(SOLVED) Java build path error in cocos2dx 3.6

java,ant,path,android-ndk,cocos2d-x
I migrated from cocos2dx 3.1.1 to 3.6 yesterday. And when I make new project and build in eclipse, I get the following error: could not open 'C:\Program Files (x86)\Java\jre7\lib\i386\jvm.cfg This isn't simple problem. I have quadraple checked environment variables. Although all of my environ variable is on E:\, build_native is...

NewGlobalRef/DeleteGlobalRef when returning object created in JNI

java,android-ndk,jni
When returning reference to object created in JNI method to Java, should we return result of NewGlobalRef call on created object? And, respectively, later, when object no more required in Java, do we need to call JNI method to do DeleteGlobalRef on the reference passed from Java? Or NewGlobalRef/DeleteGlobalRef required...

ndk-build .so incompatible target (prebuilt shared library)

android,android-ndk
LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) LOCAL_MODULE := slabhidtouart LOCAL_SRC_FILES := libslabhidtouart.so include $(PREBUILT_SHARED_LIBRARY) include $(CLEAR_VARS) LOCAL_MODULE := TestJNI ### Add all source file names to be included in lib separated by a whitespace LOCAL_C_INCLUDES := $(LOCAL_PATH) LOCAL_SRC_FILES := TestJNI.cpp LOCAL_SHARED_LIBRARIES := slabhidtouart LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/jni include $(BUILD_SHARED_LIBRARY) compiling...

tess-two reciving int but waiting for long

java,android,c++,android-ndk,tess-two
I tried to rebuild an android app wich contains tess-two as library. When using as is, I get this error java.lang.NoSuchFieldError: no field with name='mNativeData' signature='I' in class Lcom/googlecode/tesseract/android/TessBaseAPI; When reverting commit bc931c966f5a05745bd4be5833f551643589982d (private long mNativeData; changed to private int mNativeData;) It then works. It might be related to my...

Gradle: Execution failed for task ':*application-name-here*:compileDebugNdk', where can I see the adequate error messages?

android,intellij-idea,gradle,android-ndk,android-gradle
I am getting this when I am trying to compile and launch: Error:Gradle: Execution failed for task ':*application-name-here*:compileDebugNdk'. > com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/path/to/android-ndk/ndk-build'' finished with non-zero exit value 2 OK cool, it is about compilation error, but where can I see compiler error messages? I set ndk up with:...

Operator new does not throw bad_alloc on Android

android,c++,android-ndk
I am developing a C++ game on Android NDK (android-ndk-r9b). If I write this: class Test { char c[1024*1024*1024]; }; //in main try { Test* p; while (1) { p = new Test(); } } catch (bad_alloc) { cout << "bad_alloc\n"; } it doesn't throw. If I try this: void...

DCIM directory path on Android - Return Value

android,c++,android-ndk,jni
I have requirement of getting DCIM directory path from Native code. I am using the following code snippet: jclass envClass = env->FindClass("android/os/Environment"); char charParam[] = "Environment.DIRECTORY_DCIM"; jstring jstrParam = env->NewStringUTF(charParam); jmethodID getExtStorageDirectoryMethod = env->GetStaticMethodID(envClass, "getExternalStoragePublicDirectory", "(Ljava/lang/String;)Ljava/io/File;"); jobject extStorageFile = env->CallStaticObjectMethod(envClass, getExtStorageDirectoryMethod, jstrParam); jclass...

error: conflicting types using C in android ndk

java,android,c,android-ndk
I am working on android application in which i am using ndk to make my native C code in java. My C and java file code is given below, i am getting error on the compilation time for conflicting types. My code is given below, please help me out here....

How to upscale and render remote(RGB565) frame buffer on Android native?

android,graphics,android-ndk,android-gui,surfaceflinger
I have ported remote frame buffer receive C code on Android 4.2.2 which receives frame buffer from host in RGB565 format. Able to render the received framebuffer following the standard android example frameworks/native/services/surfaceflinger/tests/resize/resize.cpp. Following is the code snippet used sp<Surface> surface = client->createSurface(String8("resize"), 800, 480, PIXEL_FORMAT_RGB_565, 0); SurfaceComposerClient::openGlobalTransaction(); surface->setLayer(100000); SurfaceComposerClient::closeGlobalTransaction();...

Faster alternative for getPixel and getPixel in Android Bitmap?

android,performance,android-ndk,android-bitmap,renderscript
I'm using the methods getPixel and setPixel for my Bitmap and it's so slow (getPixels too). I want to process every pixel of the Bitmap and then create another Bitmap. How can I get access to pixels by RenderScript or using C++? I think they are faster but I don't...

dlopen failed: cannot locate symbol “cblas_sdsdot” referenced by “libgsl.so”

android,c++,linux,android-ndk,gsl
I cross compiled gsl for android using arm-linux-androideabi compiler following the answer provided in this question. I installed the library in /home/username/AndroidGSL. I checked the file command and it gave me libgsl.so: symbolic link to `libgsl.so.0.14.0' so i did again for libgsl.so.0.14.0 and got this libgsl.so.0.14.0: ELF 32-bit LSB shared...

Return type of CallStaticBooleanMethodV does not match Java method signature - Calling Java method from C/C++

java,android,c++,android-ndk,android-5.0-lollipop
My java method signature is - public static void JRequestRender() And in C/C++ void RequestRender() { ........... ........... jclass cls = env->GetObjectClass(g_JNIWrapperObj); jmethodID mid = NULL; if(cls) { mid = env->GetStaticMethodID(cls, "JRequestRender", "()V"); } if(mid) env->CallStaticBooleanMethod(cls, mid); env->DeleteLocalRef(cls); ..................... } This is working in all version of Android except Lollypop....

Is using largeheap in Android manifest a good practice?

android,android-ndk
I am developing in NDK. It hangs in Galaxy S3. For testing I put android:largeheap = "true" in Manifest. Then there was no hanging issue. Is it a good practice to use largeHeap="true"? Is there any chance that Google rejects my build due to this tag and how can I...

java.lang.UnsatisfiedLinkError - NDK in android studio gradle?

java,android,android-studio,gradle,android-ndk
Folder structure app ---main ---java ----jni -----Android.mk -----Application.mk ----- hello-jni.c ---res in build.gradle apply plugin: 'com.android.application' android { compileSdkVersion 21 buildToolsVersion "22.0.1" defaultConfig { applicationId "com.example.hellojni" minSdkVersion 17 targetSdkVersion 21 sourceSets.main { jni.srcDirs = [] jniLibs.srcDir 'src/main/libs' } ndk { moduleName "hello-jni" cFlags "-std=c++11 -fexceptions" ldLibs "log" stl "gnustl_shared" abiFilter...

Why does creating a C++11 thread cause a Fatal Signal?

android,multithreading,c++11,android-ndk,jni
I want to create a C++11 thread that runs indefinitely, after a JNI call has been made. Why does this generate a Fatal Signal? #include <thread> static void teste() { while(true) LOGI("IN TEST"); } JNIEXPORT void Java_blahblah(JNIEnv *javaEnvironment, jobject self) { std::thread t(teste); //t.join(); //I don't want to join it...

How to build CLM in android

java,android,android-ndk
I am building clm in android, my .mk file look like this LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) OPENCV_INSTALL_MODULES:=on LOCAL_MODULE := sample_CLM_SO_File FILE_LIST := $(wildcard $(LOCAL_PATH)/*.cpp) LOCAL_SRC_FILES := $(FILE_LIST:$(LOCAL_PATH)/%=%) FILE_LIST1 := $(wildcard $(LOCAL_PATH)/Users/caffe/caffe-android-lib/Boost-for-Android/build/lib/*.a) LOCAL_SRC_FILES := $(FILE_LIST1:$(LOCAL_PATH)/%=%) LOCAL_CPP_INCLUDES := /Users/caffe/caffe-android-lib/Boost-for-Android/build/include/boost-1_55/boost LOCAL_CPP_INCLUDES...

NDK application Signature Check

java,android,security,android-ndk,digital-signature
I have some security key in an application. I want to store it securly. I like to store it in a native shared library (maybe generated from some code). After that I want it to be returned by a method that will check the signature of the original APK. So...

ndk-build outputs ‘error adding symbols. File in wrong format’

android,c++,android-ndk,exiv2
I want to use exiv2 library written in C++ in my Android project. To do that I try to cross-compile the library using Android NDK. For cross-compiling I follow presented below steps: Add the ndk path to variable PATH $ PATH="/home/patrycja/android-packages/ndk:${PATH}" $ export PATH Install the standard toolchain for cross-compiling...

How to Build curl with NDK 10rd in windows

android,windows,curl,build,android-ndk
I am new to NDK, Now I want to build curl with NDK 10rd in windows 7. I download curl's code at[https://github.com/bagder/curl]. I have tried and searched many ways. But It does not work. The error info is : E:/study/thrid_lib/curl-master//jni/src/setup.h:41:25: fatal error: curl_config.h: No such file or directory #include "curl_config.h"...

Error for cv::FileStorage in JNI

android,c++,opencv,android-ndk,file-storage
I am getting errors while compiling my native.cpp file in Eclipse ADT/NDK. While compiling the following lines of code FileStorage storage(nativepath, FileStorage::WRITE); storage << "img" << mat; storage.release(); The errors are D:/androidworkspace/Augmented-Reality//obj/local/arm64-v8a/objs/ndksetup/native.o: In function Java_com_shahrukh_AugmentedReality_CAMShiftDetection_savemat(_JNIEnv*, _jobject*, long long, _jstring*)': D:\androidworkspace\Augmented-Reality/jni/native.cpp:14: undefined reference...

Using .so files in Android Studio

android,android-studio,android-ndk,shared-libraries
I am new to Android. I have a basic hello-world native code function like this: #include <string.h> #include <jni.h> #include <cassert> #include <string> #include <iostream> #include <fromhere.h> using namespace std; /* This is a trivial JNI example. * The string returned can be used by java code*/ extern "C"{ JNIEXPORT...

MuPdf Android JNI library is very large

android,android-ndk,mupdf
As described here (https://github.com/sufficientlysecure/document-viewer/issues/88) we're facing the problem that the JNI library that is part of the MuPdf Android demo is really large. In this case, this affects the size of the Document Viewer app (https://f-droid.org/repository/browse/?fdid=org.sufficientlysecure.viewer). The *.so files in the APK are more than 12 MB in size! Before...

cocos2dx-store on andorid issued with path

android,c++,android-ndk,cocos2d-x-3.0
here is my code, I tried different version of cocos2d-x and the newest cocos2d-x-store, which the program runs well on ios device. The problem is when ever i try to complied to android platfrom, it shows Android NDK: WARNING: APP_PLATFORM android-21 is larger than android:minSdkVersion 9 in ./AndroidManifest.xml make: Entering...

ndk-stack give me only have libc frame

android,c++,android-ndk,crash
I'm working with ndk develop, and it crashed when running, i get the info from logcat, and ndk-stack it, got this: signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr -------- Stack frame I/DEBUG ( 2418): #00 pc 000221a8 /system/lib/libc.so (tgkill+12) Stack frame I/DEBUG ( 2418): #01 pc 00013265 /system/lib/libc.so (pthread_kill+48)...

double* android ndk crash

c++,pointers,android-ndk
I'm facing a peculiar problem with the android ndk. I'm trying to read a previously stored set of bytes in an unsigned char* readBytes (previous allocated and read from file). The data needs to be interpreted as double. unsigned char* svDataOffset=(unsigned char*)(readBytes+byteCounter); unsigned char* chars=(unsigned char*)(svDataOffset+2); //offset of 2 is...

Linking against third-party libraries when doing cross-platform build in Visual Studio 2015

c++,android-ndk,cross-platform,clang,visual-studio-2015
I am trying to compile a Shared Object (.so) with Visual Studio 2015 RC. I am linking against the Opus Codec libs in my stdafx.h: #pragma comment(lib, "..\\..\\opus-1.1-beta\\win32\\VS2010\\Win32\\Debug\\celt.lib") #pragma comment(lib, "..\\..\\opus-1.1-beta\\win32\\VS2010\\Win32\\Debug\\opus.lib") #pragma comment(lib, "..\\..\\opus-1.1-beta\\win32\\VS2010\\Win32\\Debug\\silk_common.lib") #pragma comment(lib, "..\\..\\opus-1.1-beta\\win32\\VS2010\\Win32\\Debug\\silk_fixed.lib") #pragma comment(lib,...

Java native methods could not be resolved in eclipse, Android NDK

android,android-ndk
I have imported the ndk sample project(HelloJni) into eclipse; it runs fine. But when I try to open and edit the C class(hello) then it shows errors (Method could not be resolved) on native methods(like jstring, JNIEnv, jobject). I have searched a lot on Google but I didn't find any...

Copy a file from sdcard location to another location in c language in Android

android,c++,c,android-ndk
I have written a code to copy a text file from one location(/mnt/sdcard/Appfolder/filename.txt) to another(/data/test/log.txt) in Android device in C language and building it using ndk. I donot know the name of the file so i have put *.txt as source file. int copy_file(char* src, char *dest) { FILE *p,*q;...

Android : Loading pre-built library - Circular dependency dropped

android,android-ndk,android.mk
I am trying to import a module into my project. Android.mk in module: LOCAL_PATH := $(call my-dir) include $(CEAR_VARS) LOCAL_MODULE := fromhere1 LOCAL_MODULE_FILENAME := fromhere1 LOCAL_SRC_FILES := $(TARGET_ARCH_ABI)/libfromhere.so include $(PREBUILT_SHARED_LIBRARY) libfromhere.so is built by ndk-build Android.mk in my project: LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) LOCAL_MODULE := native LOCAL_MODULE_FILENAME :=...

NDK - include error

android,android-ndk,jni
I need your help because it drives me crazy. What cause my error? The error is "jni/algorithm.cpp:4:33: fatal error: opencv2/core/core.hpp: No such file or directory #include <opencv2/core/core.hpp> ^ compilation terminated. make: *** [obj/local/arm64-v8a/objs/algorithm/algorithm.o] Error 1" My algorithm.cpp is: #include <jni.h> #include <string.h> #include <opencv2/core/core.hpp> #include <opencv2/imgproc/imgproc.hpp> #include <opencv2/features2d/features2d.hpp> #include "opencv2/highgui/highgui.hpp"...

How to pass a structure as an argument to java function or return to java from jni

java,android,c,android-ndk,jni
I have two questions Say I have some structure in jni say struct X { Type_A x; Type_B y; } Now how do I? Pass this structure as an argument to a java call back function How do I return this structure to a Java function. If possible, please give...

make: *** [obj/local/armeabi/objs/cocos2dcpp_shared/hellocpp/main.o] Error 1

android,eclipse,android-ndk,cocos2d-x,cocos2d-x-3.0
I am trying to port cocos2dx game on android plat from. When I build the project the following message appears Build of configuration Release for project test_pro python /Users/itronix/Documents/Rizwan_Projects/cocos2dx_3_2/workspace/test_pro/proj.android/build_native.py -b release all Android NDK: WARNING: APP_PLATFORM android-19 is larger than android:minSdkVersion 9 in ./AndroidManifest.xml Android NDK: WARNING:jni/../../cocos2d/cocos/./Android.mk:cocos2dx_static: LOCAL_LDLIBS is always...

Android NDK OpenSSL error cross-compiling

c,windows,android-ndk,openssl,cross-compiling
I am new in NDK and I am following this guide to build OpenSSL for Android, I am using Windows 7 and Cygwin for this. I'm having errors when trying to build the OpenSSL library. # From the 'root' directory $ . ./setenv-android.sh $ cd openssl-1.0.1g/ $ perl -pi -e...

How does NDK work in Android - What is the order that NDK, JNI etc are used?

java,android,android-ndk,jvm,jni
How are: Java, NDK, JNI, JVM, C/C++ code etc. related to each other in an android project? I want to know what happens e.g. Java code runs NDK method, NDK uses JNI library or whatever happens. Also what is the difference between NDK and JNI Sorry if this question is...

Android NDK OpenCV - No implementation found for native

android,c++,opencv,android-ndk,native
can you help me handle my errors? I have read a lot of tips how to fix them but nothing helped me. I also know that there are similar question already asked but they didnt help me. So I give a chance to ask you: I am trying to make...

Automatically copy .so files from NDK library project?

android-studio,gradle,android-ndk
Using Android Studio 1.2.1.1 with Gradle 1.2.3. I have an NDK library project A that produces a number of .so files in its own libs folder. Though, I cannot see the reference to this folder anywhere in the build.gradle file. When I reference library A from my app MyApp I...

Android NDK OpenSSL

android,windows,android-studio,android-ndk,openssl
I am new in NDK, I am trying to add openssl to my android project using C, I have looked and tried and I cannot figure out how to linked openssl libraries in Android, another reason I am asking this is because most page and post I've found that talk...

build error: no toolchain with host-setup.sh ndk-r3 with cygwin 1.7.35

android,android-ndk,cygwin
I am trying to run $ ./build/host-setup.sh but it throws the following error ./build/core/ndk-common.sh: line 44: [: too many arguments ./build/core/ndk-common.sh: line 49: [: too many arguments Checking host development environment. NDK Root : /home/NITISH NIHAR DORA/android-ndk-r3 GNU Make : make (version 4.1) Awk : awk Platform : windows Generate...

What is the best way to save JNIEnv*

android,android-ndk,jni,jnienv
I have an Android project with JNI. In the CPP file which implements a listener class, there is a callback x() . When x() function is called, I want to call another function in a java class. However, in order to invoke that java function, I need to access JNIEnv*....

Qt does not detect Android NDK

android,c++,qt,android-ndk,android-sdk-tools
I want to develop Android apps with Qt. I have Extracted the Android SDK and NDK to C:\. This is the NDK I downloaded: https://squeak-android-vm.googlecode.com/files/android-ndk-1.6_r1-windows.zip But Qt 5.2.1 does not detect the NDK and this error is shown: "C:\android-ndk-1.6_r1" does not seem to be an Android NDK top folder. Do...

Error: cannot access android.app.Activity

android,android-ndk
I am working on android application in which to make header file i am using terminal. For this i am using the following commands should in the images but getting the following errors, please help me out here: Muhammads-MacBook-Pro:MUrgency_with_JNI UsmanKhan$ javah -jni -classpath bin/classes/ -d jni/ com.ziqitza.helper.HelloJni Error: cannot access...

Android Studio 1.3 Preview NDK support

android-studio,android-ndk
Yesterday Google announced that native code debugging is now possible with this version of Android Studio. https://plus.google.com/+AndroidDevelopers/posts/2Gk6yrZKV4X I've updated to the newest build version "AI-141.1962279" and can't see any possibility of debugging native code. I've switched to build-tools 23.0-rc1, used gradle plugin 1.3.0-beta1 but cannot set breakpoints in native code...

SurfaceView on Android 2.3.6 doesn't render full region

android,android-ndk,surfaceview,surfaceholder,nexus-s
In my app I create SurfaceView and use it from NDK using ANativeWindow API: ANativeWindow_lock and then ANativeWindow_unlockAndPost. The size of the surface is set by ANativeWindow_setBuffersGeometry to 320x480. The screen size is bigger - 480x800. The SurfaceView is stretched using LayoutParams to almost full screen. The problem that I...

On Android Studio 1.3, NDK support not working

android,android-studio,android-ndk
I have upgraded the Android Studio to 1.3, about which they say they have added Native development support. But I found no change regarding NDK. :/ Any help?

How to get Crash Point in Java code

java,android,android-ndk,dalvik,addr2line
My application has android-support-v4.jar in /libs only. I do not use other library. My application is crashing with SIGNAL 11 error. I want to use addr2line utility of android-ndk. Can we find the function and line number of java file using this tool? Any help will be very helpful here...

java.lang.UnsatisfiedLinkError: Native method not found: com.ziqitza.murgency.activities.FibLib.getTestString:()Ljava/lang/String;

java,android,android-ndk
I am working on android-ndk application in which i am making on native String method to return me the string value. Library compiles without any error but on run time it gives me an exception that : java.lang.UnsatisfiedLinkError: Native method not found: com.ziqitza.murgency.activities.FibLib.getTestString:()Ljava/lang/String; My code for C and Header file...

why different result in c++ and java version?

java,android,c++,android-ndk,imagefilter
I implemented Java image filter code in c++ ndk but the results differ. The value in both is 70. Java version : public Bitmap applyContrastEffect(Bitmap src, double value) { // image size int width = src.getWidth(); int height = src.getHeight(); // create output bitmap Bitmap bmOut = Bitmap.createBitmap(width, height, src.getConfig());...

Android ndk example native-audio error

android-studio,android-ndk,opensl
I try to use the example code for OpenSl ES wich is included in NDK in Android Studio. It didn't work as you will see later on. So I need help to use the code in Android Studio. The Code was written for Eclipse but I used the import function...

compile FFMpeg for Android (Ubuntu14) - cannot locate symbol

android,ubuntu,android-ndk,ffmpeg
I'm trying to compile FFMpeg for Android and I have troubles running the APK on Android 4 (on Android 5 I don't get this shitty unsatisfied link error): 05-09 15:16:18.880 22160-22304/com.gpac.Osmo4 I/LibrariesLoader﹕ Loading library avcodec... 05-09 15:16:18.910 22160-22304/com.gpac.Osmo4 E/dalvikvm﹕ dlopen("/data/app-lib/com.gpac.Osmo4-1/libavcodec.so") failed: Cannot load library: soinfo_relocate(linker.cpp:975): cannot locate symbol "log2f" referenced...

fpscr register is not updated when enabling floating point exceptions on arm7, SIGFPE not generated

debugging,android-ndk,floating-point,arm
fpscr register is not updated and SIGFPE is not generated. This was tested on an NVidia Shield Tablet and a 1st gen Nexus 7. feenableexcept(FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW); The implementation calls code, which eventually executes this assembly: asm _volatile__("vmsr fpscr,%0" : :"ri" (fpscr)); ; disassembly follows ldr r3, [r11,...

Multiple apk versionCode distinction

android,android-ndk,multiple-apk
I have an application that supports both x86 and arm-v7 platforms. I should define different android:versionCode for different platform apks. Therefore I put for example 100 and 200 in value and upload an apk to Google Play. The issue in devices that support both platforms. If a device on x86...

Readelf reports program is a shared library instead of executable

c++,makefile,android-ndk,clang
got this strange behaviour with standalone Android NDK r10e Toolchain (built with --toolchain=x86-clang3.6 switch). Environment variables for cross compilation have been set before running makefile, SYSROOT points to Android toolchain location, CXX equals i686-linux-android-clang++. Basically, I have a bunch of cpp files that I would like to compile to Android...

Debugging an ARM assembly (Neon extension)

debugging,assembly,android-ndk,arm
I am developing an algorithm that uses ARM Neon instructions. I am writing the code using assembler file (.S and no inline asm). My question is that what is the best way for debugging purpose i.e. viewing registers, memory, etc. Currently, I am using Android NDK to compile and my...

What is the difference between FFmpeg Android and FFmpeg Android Java?

android,android-ndk,ffmpeg
I'm trying to use FFmpeg in a new app and found these two repositories on GitHub: http://hiteshsondhi88.github.io/ffmpeg-android/ and http://hiteshsondhi88.github.io/ffmpeg-android-java/. What are their differences? I mean, Android NDK is just a way to put native code together with your Java code, right? If so, using FFmpeg-android as a shared native library...

ndk-build 'JNI_CreateJavaVM' was not declared in this scope

java,android,c++,android-ndk
I have error while trying invoke java method from native code. [arm64-v8a] Compile++ : hell <= hell.cpp /home/zns/AndroidStudioProjects/Test/app/src/main/jni/hell.cpp: In function 'int main()': /home/zns/AndroidStudioProjects/Test/app/src/main/jni/hell.cpp:8:42: error: 'JNI_CreateJavaVM' was not declared in this scope JNI_CreateJavaVM(&jvm, &env, &vm_args); ^ make: *** [/home/zns/AndroidStudioProjects/Test/app/src/main/obj/local/arm64-v8a/objs/hell/hell.o] Error 1 hell.cpp #include <string.h> #include <jni.h> int...

Android armeabi devices with API level 15+

android-ndk
I'm developing an app for API level 15+ that has some jni code and i'm wondering if there are devices with armeabi ABI (ARMv5) and API level 15+ Can i include only armeabi-v7a and x86 libraries and skip the old armeabi?...

adb screencap output is different than on the device

android,opengl-es,android-ndk,adb
I have a graphical glitch related to blending in my OpenGL application using Android NDK. The strange thing is that when I take a screenshot through adb screencap command, the problem completely disappears and the result looks okay. My question is: Is there a way to know what is happening...

Set Android NDK globally in Android Studio

android,android-ndk
The current version (1.2.1.1) of Android Studio allows me to build sample apps using the NDK, but I have noticed that each time I load a new project, I must set ndk.dir=/path/to/ndk/install in my local.properties file for Gradle to detect the NDK, whereas the sdk path is auto-populated. Is there...

NDK & Android Studio, compiling it crashes because of shared libraries

android,c++,android-ndk
For code reusing I had to move some native code from the working directory to a shared library. This movement however causes a lot of troubles. If I try to compile it in the old place, everything just clicks, instead if I try to compile it with the same data...

Getting Android Bluetooth Adapter Name from JNI/C++

android,c++,bluetooth,android-ndk,jni
The Android API in question is android.bluetooth.BluetoothAdapter, which has a member function getName() which returns the adapter's user friendly name. In java: BluetoothAdapter.getDefaultAdapter().getName() I know I can wrap this in a java-function, which I call through jni, but, how can I achieve the same in C++, with only jni/android-ndk?...

ndk-build and command not found using eclipse mac

android,eclipse,bash,android-ndk
I am developing and android application in mac using eclipse for android-ndk. I have already given NDK path in eclipse. At the end when i am giving this command to build my application using android-ndk but getting the following errors: command: ndk-build ndk-build-bash: ndk-build: command not found Please help me...

Native method not found: Package.methodName:()Ljava/lang/String;

java,android,android-ndk
Good day, I am having trouble on android ndk development. I am very new to ndk and following a tutorial. On compilation time no error comes but when i uploaded the application in device it gives me an error that Native Method Not Found. I have attached the code and...

How to write the Android.mk script?

android,android-ndk,android.mk
jni/ Android.mk -> libmyso.so folder1/ Android.mk -> libso1.so folder2/ Android.mk -> libso2.so How to compile the libso1.so and libso2.so into the libmyso.so? Thus, I can only load libmyso.so in the java code, and needn't load libso1.so and libso2.so respectively....

A resource was acquired at attached stack trace but never released. memory leak

java,android,memory-leaks,android-ndk,jni
If I comment out the method (*a)->CallVoidMethod(a, b, meth, "FROM JNI"); The app doesn't crash else it crashes. Assuming that I haven't released the resource "jstr" which might have caused a memory leak then why does it happen only when CallVoidMethod() ? What should I do to solve this issue?...

Can native code cause memory corruption in Java code in Android?

android,android-ndk,dalvik,memory-corruption
In Android, when we call native code via JNI, can it corrupt the Dalvik VM, and the Java code running inside it? For example, suppose we have this C method and we call it via JNI: JNIEXPORT void JNICALL Java_MemoryCorruptor_corruptMemory() { while (1) { char *p = randomAddress(); *p =...

Infinite rebuild loop in Eclipse CDT

android,eclipse,android-ndk,cdt,toolchain
My setup is a bit sketchy, I'll admit. This was working correctly with Eclipse Indigo but Luna keeps rebuilding my C++ Android project over and over. This happens when I select the "Build on resource save (Auto build)" which was rather convenient. Checking this option gets me into an infinite...

can't include shared library in android studio

java,android,android-ndk
I'm having a hard time with including my own sqlite library (libsqliteX.so) in android studio: I followed this guide and loaded this and compiled it with latest android NDK (r10e) (i just added "APP_ABI := xxx" to the Application.mk to build also x86 and armeabi-v7a versions of it) and got...

How to render a 3D file using Assimp library [closed]

android,c++,opengl-es,android-ndk,assimp
I am working on an android project, in which I need to render 3D file. I have decided to use Assimp library after a lot of research. I have successfully compiled Assimp library.. But I am not able to render a file using it. There is not much documentation available...