android-ndk

avoid using of .a for creation of .so

时光毁灭记忆、已成空白 提交于 2019-12-24 18:40:31
问题 i have created an android application,here most of my code is in c so i have created it using jni. i have to create socket.so file, in which i have to use the libtest.so . while using the libtest.so in socket.so i get the error:undefined reference to function() . my function() is present inside the libtest.so . so to avid this by suggestion i have created my Android.mk as below: LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) LOCAL_MODULE := libtest LOCAL_SRC_FILES := libtest.so include $

How to avoid relative paths in include folder

匆匆过客 提交于 2019-12-24 17:53:13
问题 Within Android Studio, I have a directory structure like so: App ├── CMakeLists.txt └── src ├── foo │ ├── CMakeLists.txt │ ├── foo.cpp │ └── foo.h ├── main │ └── cpp │ ├── CMakeLists.txt │ └── main.cpp └── test ├── CMakeLists.txt └── testDriver.cpp In main.cpp, I would like to #include "foo.h" or even #include "fooLib/foo.h" but It won't compile unless I #include "../../fooLib/foo.h" . I am trying to configure CMake within android studio to allow me to use the former. I tried export, target

VideoView-To Play swf file

Deadly 提交于 2019-12-24 17:28:16
问题 I made an application in which I want to play an SWF file in a raw folder. When I run the app, it shows Sorry, the video cant be played. I don't know how to rectify it. I've installed the Adobe Flashplayer11.apk and SWF player on the device. However when I run my apk, it couldn't open. Is the VideoView capable of playing SWF videos? Here's my code: package com.video.in; import android.app.Activity; import android.net.Uri; import android.os.Bundle; import android.widget.MediaController; import

NDK: How to reference native sources OUTSIDE Android project?

雨燕双飞 提交于 2019-12-24 17:13:22
问题 I'm using Android Studio 1.2.2 and just downloaded 1.3RC3, as it reputedly has full NDK support. I have a working project while my .c / .h files remain in app/src/main/jni ; however, I want them in AndroidProject/../common/src , i.e. outside the android project folder. How do I make this work? To reiterate: this question is about EXTERNAL, NATIVE CODE ; not importing external java! 回答1: This was so simple, I didn't think to even try it at first, but it worked at once: android{ ... sourceSets

Android Studio 1.3 RC1 NDK Unable to load native library

∥☆過路亽.° 提交于 2019-12-24 17:05:48
问题 Tonight I switched my ndk application to work with the new Android Studio 1.3 preview. I have 2 devices Nexus 5(5.1.1) and MotoG(4.4.4). When compiled via ndk-build the application works on both devices. Using gradle build the Nexus 5 executes correctly but on the MotoG I get an exception: 07-11 04:13:58.509 16751-16751/com.mbyan.android E/AndroidRuntime﹕ FATAL EXCEPTION: main Process: com.mbyan.android, PID: 16751 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mbyan

Configuring cygwin for building ndk project

你。 提交于 2019-12-24 16:41:10
问题 I have searched on the Internet a lot and I'm trying to build my ndk files and then include them to my Android project on eclipse. After searching on Internet I came to know that cygwin is required to build ndk project. I have downloaded the necessary files for cygwin, however I'm blank for the next step. i.e steps for how to build my ndk files on cygwin terminal and then include them to my eclipse android project. Kindly help me on these steps. Would be appreciated! 回答1: If you are using the

Building native openCV with NDK on android studio

旧时模样 提交于 2019-12-24 16:28:03
问题 I am making a C++ project which uses openCV and I wish to build it on android studio using android NDK support. On doing so I found out that only the experimental version of gradle supports NDK. I am currently using version 0.2.1 of gradle. I imported opencv as a module and copied the libraries to jniLibs folder under src/main/ I tried to compile it but I got certain errors like undefined reference to some functions in parallel.cpp of libopencv_core.a . They were resolved on importing the

what is the magic of nativeLibsToJar

妖精的绣舞 提交于 2019-12-24 15:54:37
问题 The following code snippet seems to be the answer how to include native libraries with Android Studio: task nativeLibsToJar(type: Zip, description: 'create a jar archive of the native libs') { destinationDir file("$buildDir/native-libs") baseName 'native-libs' extension 'jar' from fileTree(dir: 'libs', include: '**/*.so') into 'lib/' } tasks.withType(Compile) { compileTask -> compileTask.dependsOn(nativeLibsToJar) } It seems to simply pack the *.so into *.jar. But I really don't understand it

get all 0 data when capture video using v4l2 on android

纵饮孤独 提交于 2019-12-24 15:53:34
问题 i am trying to capture video on android using v4l2 under jni. i found some guide and followed the step: fd = open("/dev/video0", O_RDWR); /* init part */ ioctl(fd, VIDIOC_QUERYCAP, &caps); ioctl(fd, VIDIOC_ENUM_FMT, &fmtdesc); ioctl(fd, VIDIOC_S_FMT, &fmt); ioctl(fd, VIDIOC_REQBUFS, &req); ioctl(fd, VIDIOC_QUERYBUF, &buf); ioctl(fd, VIDIOC_QBUF, &buf); /* capture part */ FILE *fp = fopen("/sdcard/img.yuv", "wb"); for (i = 0; i < 20; i++) { ioctl(fd, VIDIOC_DQBUF, &buf); fwrite(buffers[buf

CallIntMethod result -1 - ANDROID JNI

南笙酒味 提交于 2019-12-24 15:38:19
问题 I would like to use the ANDROID SharedPreferences from C. For easier usage, I've a class and some methods for it (getIniParamInt, getIniParamString etc.) The things works fine in JAVA. The problem is, if I call the method from jni it sends back -1 to C. Parts of my JAVA code (simplified for test, SharedPref. removed etc.): public class IniManipulate { public int getIniParamInt(String mezoNev) {return 999;} // settings.getInt("abc", -9999); C code: const char* paramOut paramOut = "abc";