Tag: android-ndk

Call a static java method of another package from native code

For example, let’s say that in Android, I need to call the static method android.os.SystemClock.elapsedRealtime(), which returns a long, from a portion of native code. In the mylib.c file, I have JNIEXPORT jlong JNICALL Java_com_mpackage_MyClass_nativeMethod(JNIEnv *env, jobject obj){ jclass cls = (*env)->GetObjectClass(env, obj); jmethodID mid = (*env)->GetStaticMethodID(env, cls, “android.os.SystemClock.elapsedRealtime”, “(V)J”); if (mid == 0) return […]

Android Audio Latency Workarounds

So anybody worth their salt in the android development community knows about issue 3434 relating to low latency audio in Android. For those who don’t, you can educate yourself here. http://code.google.com/p/android/issues/detail?id=3434 I’m looking for any sort of temporary workaround for my personal project. I’ve heard tell of exposing private interfaces to the NDK by rolling […]

how to adjust volume in openSL ES (Android)?

As I read from the official docs for openSL ES, there are capabilities for setting volume level from Audio Player. But how? I tried to get VolumeItf from the audio player but got: SL_RESULT_FEATURE_UNSUPPORTED Is I understood, this message means that profiles are not suuported in Android. But how to get access to volume control? […]

XmlPullParserException: invalid drawable tag vector

I am using NDK support and getting this error: Gradle: Distribution: gradle-2.5-all Build tool: gradle-experimental:0.2.1 XML: <vector android:height=”24dp” android:viewportHeight=”125.0″ android:viewportWidth=”100.0″ android:width=”24dp” xmlns:android=”http://schemas.android.com/apk/res/android”> <path android:fillColor=”#FF000000″ android:pathData=”M97.01,-2.98,-3C47.02,95.35″/> </vector> Warning: vector requires API level 21 (current min is 13) or building with Android Gradle plugin 1.4 or higher Exception: FATAL EXCEPTION: main android.content.res.Resources$NotFoundException: File res/drawable/accelerometer.xml from drawable resource […]

Access Android sensors via NDK

I need read about 100 samples per second off the accelerometer on a Android, and at a fixed sample rate. The current sensormanager does or offers neither. I’ve read Need to read android sensors really fast He seems to have access to the driver code which made his life easier. I am curious if anyone […]

Android Studio failed build NDK project non-zero exit value

I imported a project that I was working on from an Eclipse Android SDK environment to the new Android Studio. Trying to run the project I get this Error:Execution failed for task ‘:app:compileDebugNdk’. > com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process ‘command ‘ndk/ndk-build” finished with non-zero exit value 2 So first of all for me it’s weird to see […]

Android Static Linking vs Dynamic Linking against glibc

I have been cross-compiling some Linux tools (and some of my own C code) to Android and one of the challenges that I face is that Android’s libc has some missing/stripped components and I end up patching my code to make it work with Android’s libc (for e.g. a problem like this http://credentiality2.blogspot.com/2010/08/compile-ncurses-for-android.html) Q1 : […]

Can the Android phone use the windows DirectX library?

I have some functions which draws the game screen using the Direct X library in Windows. So, I am trying to use the functions in Android phone using the ndk. But I have some problems. Dose the Android phone which use the Java recognize the Direct X functions? If it is possible, then I must […]

is arm-eabi-gcc different than arm-linux-androideabi-gcc

Is arm-eabi-gcc different than arm-linux-androideabi-gcc? Can I swap arm-eabi-gcc with arm-linux-androideabi-gcc to the agcc script from this site http://www.plausible.org/andy/agcc?

build type isn't jni debuggable error

i want to debug c++ ndk with android studio but when i create a “Android Native” run configuration, I get the error “Build type isn’t jni debuggable”. my build.gradle : import org.apache.tools.ant.taskdefs.condition.Os apply plugin: ‘com.android.application’ android { compileSdkVersion 23 buildToolsVersion “23.0.1” defaultConfig { applicationId “org.amk.test” minSdkVersion 11 targetSdkVersion 23 versionCode 1 versionName “1.0” ndk { […]

Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.