I see several possible causes. First of all, casting char* to double* and then accessing it through that pointer is undefined behavior. Most of time it works, but you are warned. Pointer misalignment. double is most likely supposed to be aligned to 8 bytes, and you read it through pointer...
android,android-ndk,jni,jnienv
Caching a JNIEnv* is not a particularly good idea, since you can't use the same JNIEnv* across multiple threads, and might not even be able to use it for multiple native calls on the same thread (see http://android-developers.blogspot.se/2011/11/jni-local-reference-changes-in-ics.html) Writing a function that gets the JNIEnv* and attaches the current thread...
c++,android-ndk,android-sqlite
You can use std::to_string to build a string using your variables #include <string> std::string sql = " INSERT OR REPLACE INTO " + std::to_string(TypeContract.CTablePhotoMatch.TABLE_NAME) + "(" + ...; If any of your variables are already std::string, then you don't need to use this function you can simply use + to...
I got answer to Build CLM in android using Androidndk. In Application.mk file i did mistake i didnt add CPP_FLAGS -std=c++11. My Application.mk file look like this APP_STL := gnustl_static APP_CPPFLAGS := -frtti -fexceptions -std=c++11 APP_ABI := armeabi-v7a APP_PLATFORM := android-9 Finally i build so generation for CLM...
android,android-ndk,multiple-apk
x86 devices are able to handle ARM libs but there is no ARM device able to handle x86 libs. So you only have to keep the version code of your x86 APK higher than the one of your ARM apk, and the right APK will go to the right device....
java,android,encryption,android-ndk,openssl
You've zero padded your plaintext in your JNI code: const size_t encs_length = ((srcLen + AES_BLOCK_SIZE) / AES_BLOCK_SIZE) * AES_BLOCK_SIZE; unsigned char enc_data[encs_length]; memset(enc_data, 0, sizeof(enc_data)); But your Java code is using PKCS #7 padding. One of these will need to change. Note: I think (based on some research) that...
This is bug in Android build of GNU libstdc++. If you look into operator new implementation, you'll see it call _GLIBCXX_THROW_OR_ABORT if malloc return NULL. Next, if you look on definition of _GLIBCXX_THROW_OR_ABORT, you'll see it throw bad_alloc only if __EXCEPTIONS defined; otherwise, it just call abort. For some...
you've compiled exiv2 for armv5+ devices running at least Lollipop. Here ndk-build fails because it's trying to link it from an arm64-v8a library it's building. Cross compiling without using ndk-build is hard to get right on Android, especially as you should support not only armv5, but also armv7, x86, x86_64,...
android,android-ndk,surfaceview,surfaceholder,nexus-s
After a bit of debugging and reading source code of SurfaceView I found solution. Apparently, ANativeWindow_setBuffersGeometry is not enough and the size should be also set from java. This helped me: public void surfaceCreated(SurfaceHolder holder) { holder.setFixedSize(BuildConfig.VIDEO_WIDTH, BuildConfig.VIDEO_HEIGHT); } ...
android-studio,android-ndk,opensl
So I answer it on my own. Solution was that in android Studio it needed to be compiled with first: ndk-build second: ndk-build TARGET_PLATFORM=android-xy xy: must be replaced with android version This is definitly not the correct way but at least it made it work....
android,c++,ios,android-ndk,porting
MSVC++ to C compilers come in the "if you have to ask, you can't afford it" category. Just too small a market. A more realistic chance would be to wait what Microsoft is doing. They're seriously looking into targeting additional mobile platforms with MSVC 2015. TLS is probably the easiest,...
The NDK allows you to write code using C/C++ and then link it into your Java application. You can potentially increase the speed of your application. The downsides to the NDK are, it only compiles to specific CPUs (whereas staying in Java land means it will work on any targetted...
java,android,c,android-ndk,jni
If you pass a data structure to Java, this must be a Java object. You can either create it on the JNI side, or fill in a parameter object passed to JNI by Java. (E.g. Java can create a new byte[4096] and pass it to a JNI function to store...
java,android,android-ndk,dalvik,addr2line
You can't get the stack trace for code written in the Java programming language out of a native stack trace in the Dalvik VM, for the simple reason that Dalvik uses different pieces of memory for the native and managed stacks. (I believe it's possible to get it from Art...
android,c++,linux,android-ndk,gsl
I replied on your other post also regarding gsl. Please follow that procedure. I hope it will help you and you can easily use that static lib in your android app.
android-studio,gradle,android-ndk
I does not know if ther is a way to have you .so files copied as you want whiout wirtting anything. But you could have gradle doing it for you. In your gradle file, add a task that copy those .so files where you need them to be. android {...
Short Answer No, if you need it it is not a bad pactise because it is there for it. Long Answer Official doc states Whether your application's processes should be created with a large Dalvik heap. This applies to all processes created for the application. It only applies to the...
android,multithreading,c++11,android-ndk,jni
According to this answer, the destructor of the thread will call std::terminate if the thread is still joinable at time of destruction. If you do not want to join the thread, you can fix this by detaching the thread instead. std::thread t(teste).detach(); ...
To get correct signatures for your native functions you can automatically create the JNI header: /* JNI header: this header can be build automatically with "javah": * javah -classpath bin/classes -d jni activities.murncy.zitza.HelloJni * (maybe you have to add "-bootclasspath /opt/android-sdk/platforms/android-21/android.jar") */ #include "activities_murncy_zitza_HelloJni.h" To avoid the warning you can...
android,debugging,android-studio,android-ndk
Actually, the advertised NDK support isn't available yet, even if you download the ndk-bundle and update Android Studio to the latest version in the canary channel (1.3-preview3 as of now). The SDK tools team said that the NDK support wasn't part of the first previews of Android Studio 1.3. However...
java,android,memory-leaks,android-ndk,jni
StrictMode only reports failures to release objects that are explicitly monitored by StrictMode. It doesn't fire because you fail to release a string from JNI. The object allocated at the point in the code indicated by the stack trace needs to be released with an explicit close() call before the...
I do not use Eclipse for Android Development, so I only went to Step 3. Steps from Google docs: Source: https://developers.google.com/games/services/cpp/gettingStartedAndroid#step_3_run_the_sample Download the Android SDK and the Android NDK and extract them to your machine. In your environment, set SDK_ROOT to the location of your Android SDK folder and NDK_ROOT...
android,opencv,android-ndk,jni
You should add OpenCV's include directory to the LOCAL_C_INCLUDES otherwise the compiler won't find them LOCAL_C_INCLUDES := $(OPENCVROOT)/sdk/native/jni/include ...
1) Splitting .apk NDK support in AndroidStudio and choosing between Android Studio and Eclipse 2) Minimizing MuPDF It is absolutely essential you build the library from sources yourself and generate multiple .sos based on platform (the sources contain strong hints on how to achieve this so I'll not go into...
AOSP itself doesn't support ARM versions below ARMv7 from Android 4.0 (API level 15), but there are custom builds that run on ARMv6. I'm not entirely sure if there are any official, certified compatible devices that run such a combination though. So in practice you should be pretty safe to...
java,android,c++,android-ndk,tess-two
In the commit you're referring to, that field was changed to be a "long" in both the Java and JNI code in order to support 64-bit devices. It should be left as a "long" across the board. If you're using a project that uses a precompiled version of tess.so, you...
I'm not super familiar with NDK, but it looks like your C code and the associated header file don't use the same package name. One is com_testing_ndk_FibLib and the other is com_ziqitza_murgency_activities_FibLib.
android,c,android-studio,android-ndk
Android studio is probably ignoring your Android.mk and generating its own. At the present instant in time, the NDK isn't well supported by Android Studio, and although you will find various version-specific gradle rule modifications which have apparently worked for their authors, it may be easier build the NDK code...
It's hard to believe you really must use NDK r.3 in 2015. Lots of weird bugs have been fixed since then, and lots of improvements have been introduced, including standalone toolchain handling. Note that cygwin is not required by NDK anymore, but need some bash to use standalone toolchain. I...
android,c,sockets,nullpointerexception,android-ndk
Remove the "exit(0)" from the void error() functions
android,android-studio,android-ndk
Not available yet. "As announced at Google I/O, Android Studio 1.3 will include C/C++ support as well, but that is not included in the first couple of preview builds." Source: https://sites.google.com/a/android.com/tools/recent/androidstudio13preview1available ...
android,android-studio,android-ndk,opensl
OpenSL library is available for android platforms with API 9+, so you may want to change the mininimum required sdk. Not sure how NDK chooses for which platform to compile, but you may need to compile yourself also using a custom Application.mk file like this: APP_ABI := armeabi APP_PLATFORM :=...
android,c++,opencv,android-ndk,file-storage
After a lot of debugging I found that the error was quite small The error was in the line LOCAL_LDLIBS := -llog -ldl The line should have been LOCAL_LDLIBS += -llog -ldl ...
android,android-ndk,android.mk
If libso1.so and libso2.so are dependencies of libmyso.so (e.g. declared via LOCAL_SHARED_LIBRARIES in Android.mk, they will be loaded automatically on Android 5.0 - the fact that you need to load them in reverse order (loading first the dependencies, then libmyso.so itself) is only a limitation of the linker in old...
android,c++,android-ndk,cocos2d-x-3.0
Add LOCAL_WHOLE_STATIC_LIBRARIES += cocostudio_static and $(call import-module,editor-support/cocostudio) into Android.mk
c,windows,android-ndk,openssl,cross-compiling
Using this guide and modifying the file setenv-android.sh you can easy compile openssl for arm, x86 and mips. You just have to modify _ANDROID_NDK _ANDROID_ARCH _ANDROID_EABI _ANDROID_API parameters note: for mips you'll have to add some lines in the file around around line 120: arch-mips) ANDROID_TOOLS="mipsel-linux-android-gcc mipsel-linux-android-ranlib mipsel-linux-android-ld" ;; around...
android,c++,gcc,android-ndk,linker
You can just include the source file cpu-features.c in your project, or build it manually with gcc: arm-linux-androideabi-gcc -c cpu-features.c -o cpu-features.o --sysroot=$SYSROOT arm-linux-androideabi-ar rcs libcpufeatures.a cpu-features.o It shouldn't require any special compiler flags or extra defines, but when linking to it, you may need to add -ldl since it...
android,android-ndk,dalvik,memory-corruption
Native code runs in the same process as the Java code it interacts with via JNI, so yes, it is very much able to corrupt key data structures. Most often you might see this as a crash within the library implementing the VM itself, shortly after the return from misbehaving...
android,c++,opengl-es,android-ndk,assimp
Assimp is a library for reading different types of 3D model. It will NOT render them. In order to do this you will need to either find a suitable rendering library or write your own, but this will not be easy if you do not have a good understanding of...
java,android,android-ndk,jni,leptonica
Following Alex Cohn 's advice I made the following code work: JAVA public byte[] getData() { byte[] buffer = nativeGetData(mNativePix); if (buffer == null) { throw new RuntimeException("native getData failed"); } return buffer; } private static native byte[] nativeGetData(long nativePix); Native jbyteArray Java_com_googlecode_leptonica_android_Pix_nativeGetData( JNIEnv *env, jclass clazz, jlong nativePix) {...
LOCAL_C_INCLUDE := /home/nemesis/adt-bundle-linux-x86_64-20140702/OpenCV-2.4.10-android-sdk/sdk/native/jni/include/opencv2 should be LOCAL_C_INCLUDES := /home/nemesis/adt-bundle-linux-x86_64-20140702/OpenCV-2.4.10-android-sdk/sdk/native/jni/include ie, it is plural and should point to the location from which the following is a relative path: #include <opencv2/core/core.hpp> ...
From the NDK's jni.h #if 0 /* In practice, these are not exported by the NDK so don't declare them */ jint JNI_GetDefaultJavaVMInitArgs(void*); jint JNI_CreateJavaVM(JavaVM**, JNIEnv**, void*); jint JNI_GetCreatedJavaVMs(JavaVM**, jsize, jsize*); #endif As the only supported way to use the NDK is from a Java application so the Java JM...
c++,makefile,android-ndk,clang
clang++ keeps producing .so shared library (checked with readelf - it is indeed shared object). Is there a special switch to compiler / linker that I have forgotten? My guess: readelf is outputting Elf file type is DYN (shared object file), and you are interpreting that to mean a...
android,android-studio,android-ndk,openvpn,ndk-build
64-bit ARM & X86 devices (not sure about MIPS) running Lollipop can execute 32 or 64-bit native code (ARMv7a/ARMv8 and X86/X64). Android allows you to bind native code libraries with multiple ABI's (CPU-specific code) into an APK. These are also called "FAT" binaries. For example, to build a FAT binary...
android,windows,curl,build,android-ndk
I have solved this problem.The details are below: Put the curl(My curl's version is 7.42.1) into the jni folder. Download the file(http://mtterra.com/files/curltest.tar.gz) and extracting it. Copy the curl_config.h to the curl/lib. Copy the Android.mk to the jni folder. Run ndk-build in cmd. That 's all. If you have anythings confused,...
If you set the environment variable ANDROID_HOME to the location of your SDK and ANDROID_NDK_HOME to the location of your NDK, and delete any local.properties file, this builds projects with native code as expected on my Android Studio 1.2. I don't know why gradle clears other property setting mechanisms when...
debugging,assembly,android-ndk,arm
Poor man's debug solutions... You can use gdb / gdbserver to remotely control execution of applications on an Android phone. I'm not giving full details here because they change all the time but for example you can start with this answer or make a quick search on Internet. Learning to...
When returning reference to New[Type]Array, or other object created in JNI method to Java, should we return result of NewGlobalRef call on created object? Only if you also want to retain that reference for use in future JNI calls without receiving it again as a JNI method parameter. And...
android,c++,bluetooth,android-ndk,jni
First of all, you need to have permission to read this value (which you would need regardless of it being native). Add to AndroidManifest.xml: <uses-permission android:name="android.permission.BLUETOOTH"/> In native jni-land, things are a bit cumbersome. In short, this is what you need: Get class android.bluetooth.BluetoothAdapter Get static method BluetoothAdapter.getDefaultAdapter() Get method...
android,eclipse,android-ndk,cdt,toolchain
It seems that this was caused by "CDT GCC Build Output Parser" and "Binary Debug Data Entries" in Properties -> C/C++ General -> Preprocessor Include Paths, Macros etc. (Gotta love the etc in the name...) No clue what this was about, but unchecking it stopped the infinite loop...
android,performance,android-ndk,android-bitmap,renderscript
Use getPixels() to get all the pixels, modify the values in the byte[], then call setPixels() to store all the pixels at once. The overhead of calling setPixel() on each individual pixel is killing your performance. If it's still not fast enough, you can pass the array to an NDK...
it looks like you need to specify the path to the android.jar, which is usually located under sdk/platforms/android-version javah -jni -classpath /path/to/sdk/platforms/android-version/android.jar:bin/classes/ -d jni/ com.ziqitza.helper.HelloJni or with javah -jni -bootclasspath /path/to/sdk/platforms/android-version/android.jar -classpath bin/classes/ -d jni/ com.ziqitza.helper.HelloJni ...
You could use the system() function to do this. For example, for Windows, you could just use the copy command to copy txt files. system("copy C:\src\dir\*.txt C:\dest\dir\"); Or with variables (pseudo code): #define PATH_MAX 4096 char command[MAX_PATH * 2 + 6]; char *file1 = src, *file2 = dest; strcpy(command, "copy...
android,graphics,android-ndk,android-gui,surfaceflinger
You're currently using private SurfaceFlinger APIs, which require privileged access. If you need to do that, I think you want to use the setSize() call to change the size of the window (which is independent of the size of the underlying Surface). This section in the arch doc shows how...
debugging,android-ndk,floating-point,arm
The ARM ARM has this to say about all the exception-trapping bits in FPSCR: [...]. This bit is RW only if the implementation supports the trapping of floating-point exceptions. In an implementation that does not support floating-point exception trapping, this bit is RES0. The Tegra K1 SoC in the SHIELD...
java,android,android-ndk,jvm,jni
The NDK is used to compile C/C++/asm code into binaries. You can do a lot of things with the NDK, like compiling executables, static prebuilts... but in the end, in the context of an Android application, you obtain one or more .so files (shared object libraries). From Java, you can...
android,c++,android-ndk,opengl-es-2.0,framebuffer
You create separate renderbuffers for depth and stencil: GLuint depthStencil[2]; glGenRenderbuffers(2, depthStencil); glBindRenderbuffer(GL_RENDERBUFFER, depthStencil[0]); glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT16, width, height); glBindRenderbuffer(GL_RENDERBUFFER, depthStencil[1]); glRenderbufferStorage(GL_RENDERBUFFER, GL_STENCIL_INDEX8, width, height); glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, depthStencil[0]); glFramebufferRenderbuffer(GL_FRAMEBUFFER,...
android,c++,opencv,unity3d,android-ndk
I found out, after much trial and error, that the reason for the error is that Android somehow manages to mess the library dependencies up. The work-around is to manually load the libraries in the specific order of their dependencies, using LoadLibrary. This can be done in Unity using AndroidJavaClass...
To enable C++ in the NDK, add LOCAL_CPP_FEATURES := rtti exceptions and LOCAL_CPPFLAGS += --std=c++11 to the jni/Android.mk file. By default, the NDK supports only a C++-like language. Note that there's no underscore between CPP and FLAGS. Also, I've used += because this won't overwrite other flags such as -Wall....
android,android-studio,android-ndk,shared-libraries
You said you were using Android Studio, but by default Android Studio currently ignores your Makefiles and use its own auto-generated ones, with no support for native depencies (for now). If you deactive the built-in support and do calls to ndk-build yourself, by putting something like this inside your build.gradle:...
Android Studio 1.3.0-Preview is indeed available through the Android Studio "Check for updates" menu. Unfortunately, all C++ features aren't available yet in this preview. They will be available in about 2 weeks. Source : Google IO dev tools keynote at 35:38...
c++,linux,android-ndk,porting,rooted-device
Referring to the Android stackexchange answer offered by ferzco, I settled on the following solution that works on my rooted Samsung Galaxy S4: /var/run/myTool/ => /data/log/myTool/run/ /var/log/myTool/ => /data/log/myTool/log/ /etc/myTool/ => /etc/myTool/ /tmp/ => /data/local/tmp/myTool/ I used /data/log/myTool as the base for two of the directories and /data/local/tmp for a...
We managed to compile it for NDKr10d. It should be the same for NDKr10e. The project-config.bjam should point to the gcc compiler from the NDK. Ours looks like this : import option ; using gcc : arm : D:\\android\\ndk\\toolchains\\arm-linux-androideabi-4.9\\prebuilt\\windows-x86_64\\bin\\arm-linux-androideabi-g++.exe ; option.set keep-going : false ; Then just compile with b2,...
android,android-ndk,android.mk
My mistake is the value of LOCAL_MODULE_FILENAME. It must be libfromhere1 instead of fromhere1. ndk just puts .so suffix to the given name but it won't put lib prefix. Always it is better to give name by yourself than letting ndk name it for you. But I didn't understand why...
java,ant,path,android-ndk,cocos2d-x
Resolved myself. I successfully have built the project. I test cocos2dx 3.6, 3.5, 3.4 . A all of them are failed. But find out how to make it! Below is my method. First, I change tools version to below things. And change environment variables to fit them. cocos2dx 3.4 NDK...
java,android,security,android-ndk,digital-signature
I will try to answer your first question here: Signature of your application is stored in the DEX(Dalvik executable) file of your APK. DEX files have following structure: Header Data section(contains strings, code instructions, fields, etc) Arrays of method identifiers, class identifiers, etc So, this is the beginning of the...
android,eclipse,bash,android-ndk
Instead of ndk-build command, simply type ~/Desktop/AndroidNDK/android-ndk-r10d/ndk-build in your terminal.
android,c++,qt,android-ndk,android-sdk-tools
First of all I strongly recommend to install the latest version of Qt for Android (5.4.1 at present). Also you should download and install Android SDK (ver. 22+) and NDK (ver. r9+) from here. After downloading extract them. For Android SDK you should have a connection to Internet and download...
The command you're probably looking for is ndk-build, not ndk.
This reference: LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) LOCAL_MODULE := slabhidtouart LOCAL_SRC_FILES := libslabhidtouart.so include $(PREBUILT_SHARED_LIBRARY) means that you want to use libslabhidtouart.so when compiling your module. But .so files are binaries that are compatible only with one specific cpu-architecture/OS. The error you're getting means that ndk-build is trying to...
android,android-studio,android-ndk,cocos2d-x,cocos2d-android
I solved it adding this to the build.gradle file: sourceSets.main { jni.srcDirs = [] } ...
To me the error java.lang.NoClassDefFoundError: org/sqlite/database/sqlite/SQLiteCustomFunction Seems to be a Java layer error, not a C level error. Because the *.c files doesn't have package/folder structure (like "org/sqlite/database..."). So my best guess is, some .class file are not in your apk. If I were you I'd use 7zip/winrar to unzip...
android,compilation,android-ndk,cross-compiling,stress-testing
USING Android NDK You can compile an executable with NDK, there is an include $(BUILD_EXECUTABLE) statement for your Android.mk file. (which is already included in source file). STEPS Put whole source file in jni folder(create if not exist.) make Aplication.mk file. APP_STL := stlport_static APP_ABI := x86 APP_PLATFORM := android-18...
android,android-studio,gradle,stl,android-ndk
in fact, not much has changed since around january 2014 regarding NDK support in Android Studio. The 1.3 version that is out right now is only preview 3, and the amazing NDK support that has been shown at Google I/O isn't inside it yet. It should be out soon though....
android,windows,android-studio,android-ndk,openssl
I resolve partially my problem but it's not completely answer, I did compile openssl for android x86 and arm architecture in this link I post my advances. I'm not going to mark this answer as correct till I'll compile openssl for all architectures EDIT: I post the answer in this...
android-studio,sdk,android-ndk
i suggest pointing cmd to the path where the javah file is located i.e: path\javah [switches] hope that helped!
android,eclipse,android-ndk,cocos2d-x,cocos2d-x-3.0
Finally issue resolved... It may help you if you are facing same issue. First of all download ndk from this link http://androids.zone/android-ndk/#.VQKVB4GUeh2 Then compile project from command line instead of eclipse. To comiple In terminal goto proj.android folder for your created project and run this command cocos run -p android...
The second one includes a full android project and precompiled libraries. The first one is only a bunch of shell scripts that will download and compile different tools (including ffmpeg) using the NDK that you provide.
JNI peforms native method search using its name. To ensure that exported function it found is correct one, methods must be named according following scheme: Java_package_name_className_methodName For example, in you case name of native function must be Java_com_testing_ndk_FibLib_sayHello, but in your com_testing_ndk_FibLib.c there are no function with such name. Following...
android,c++,android-ndk,jni,jna
JNA provides a stub native library, libjnidispatch.so for a variety of platforms. You can build this library yourself, or extract one of the pre-built binaries from the project's lib/native/<platform>.jar packages. You include libjnidispatch.so in your Android project the way you would any other JNI library. This is required; you cannot...
Here is a simple solution Go to the properties of your Application , under C/C++ General -->Code Analysis Uncheck the Run As You Type (Selected Checkers) option as following screenshot. ...
A jint is a primitive type, so if you have included jni.h you can simply return one from the function - there is no need to allocate an Object as you were doing with NewStringUTF() for a String. JNIEXPORT jint JNICALL com_example_myapplication_MainActivity_getintONE(JNIEnv *env, jobject obj) { return 1; //or anything...
android,osx,android-ndk,32bit-64bit,ndk-build
The Android NDK is located here: https://developer.android.com/tools/sdk/ndk/index.html Make sure you are using the latest NDK, you have r10b when there is a r10d. Also, they may have simply forgotten to update the RELEASE.TXT. For Mac x86 - 32bit: http://dl.google.com/android/ndk/android-ndk-r10d-darwin-x86.bin For Mac x86_64 - 64bit: http://dl.google.com/android/ndk/android-ndk-r10d-darwin-x86_64.bin...
android,ubuntu,android-ndk,ffmpeg
You can use the latest NDK, only set platform to android-19 and not the latest android-21. You use the libraries from some cyanogenmod build, which are "too good". For example, you get from there a libm.so that has log2(). Instead, you need the least common denominator of libm.so versions on...
c++,android-ndk,cross-platform,clang,visual-studio-2015
First, the Opus Codec distribution comes with Visual Studio projects that are configured to build only Windows libraries, which are not cross-platform. You need to replace these projects with Cross Platform Library projects. Or better alternative: just download prebuilt libopus.a, e.g. from here. Second, you cannot use #pragma comment(lib, ...)...
Your signatures for the methods are different: public static native String sayHello(); // String return type here JNIEXPORT void JNICALL Java_com_testing_ndk_FibLib_sayHello(JNIEnv*env, jobject thisObj) // void return type here JNIEXPORT jstring JNICALL Java_com_testing_ndk_FibLib_sayHello // jstring (=Java String JNI) here Try changing to public static native void sayHello(); and in your header...
I post the guide that I have created for mantainance of how I fixed the problem. There may be some unrelated stuff, but they are still useful. The main problem was that I had disabled the automatic building and that the name of the methods were slightly different. Furthermore, the...
Environment.DIRECTORY_DCIM is the qualified Java name of the static String defined in the Environment class for the DCIM folder. However, it's isn't the actual value of the String, which is just "DCIM": public static String DIRECTORY_DCIM = "DCIM"; You need to pass the String value, not the Java name of...
java,android,c++,android-ndk,imagefilter
R = Color.red(pixel); ... G = Color.red(pixel); ... B = Color.red(pixel); You are taking the red value for each color in your Java code. You probably want to adjust that to take the correct value instead like so: R = Color.red(pixel); ... G = Color.green(pixel); ... B = Color.blue(pixel); As...
android,intellij-idea,gradle,android-ndk,android-gradle
You can get the error messages thrown back by ndk-build through Android Studio "Messages" and the Gradle Console: ...
android,c++,opencv,android-ndk,native
After few days of hopelessness :D I solve my problem. The issue was that $(OPENCV_INSTALL_MODULES) should be equal. At the line OPENCV_INSTALL_MODULES:=on in my Android.mk file. I overrided OPENCV_INSTALL_MODULES:=on to OPENCV_INSTALL_MODULES=on and now it works.... Perhaps it might help to someone else too :)...
You are invoke your command under Linux. The shell interpreter BASH treat ; as the command separator. The class path separator ; is for Windows. So you can change you command to following, it will work. javah -d jni -classpath /home/king/ide/android-sdk-linux/platforms/android-22/android.jar:../../build/intermediates/classes/debug/ com.lengking.ndk.MainActivity ...
java,android,android-studio,gradle,android-ndk
You've got several mistakes in your build.gradle: The nativeLibsToJar task was a relevant technique in early versions of the gradle android plugin, It shouldn't be used since at least 0.7 and it may lead to bugs, remove this task. Instead, if you put your .so files inside jniLibs/ABI directories (where...
Edit the Project Properties. Go to C/C++ Build / Builder and uncheck Use default build command. Then below you can enter your custom ndk-build -j4 command with additonal parameters.
android-ndk,google-project-tango
In your code that looks up the depth sample coordinates... for (int i = 0; i < XYZ_ij->xyz_count; i++) { float X = XYZ_ij->xyz[i*3][0]; float Y = XYZ_ij->xyz[i*3][1]; float Z = XYZ_ij->xyz[i*3][2]; ...you should be using an index of i, not i*3. It is a 2D array so you don't...
android,opengl-es,android-ndk,adb
The problem disappeared once I commented out EGL_ALPHA_SIZE setting: const EGLint attribs[] = { EGL_BLUE_SIZE, 8, EGL_GREEN_SIZE, 8, EGL_RED_SIZE, 8, //EGL_ALPHA_SIZE, 8, EGL_NONE }; It looks like with alpha set to 8 bits, eglChooseConfig returned a problematic configuration object. Funnily enough, the "correct" EGLConfig specifies 0 bits for EGL_ALPHA_SIZE, so...
android,c,android-ndk,gdb,gdbserver
So, at host, in gdb shell, before specifying the remote's target port, I should type shared. This command loads the shared symbols. Also, for compiling, I used -ggdb....
No, that would be wrong. And the differences are not only between architectures, bit also between toolchains and between platform levels. ndk-build will point each compiler to appropriate include directories. But why do you ask? What problem did you face?...