title: Android C++ OpenGL: unable to find stats
body: <p>I am fighting to run a fully native code as C++ OpenGL ES in NDK.</p>
  
  <p>The idea is to completely avoid the need to have in the Android project the folder /src with lots of java classes interfacing the process, hence boosting the embedded system speed and performance. So, we are going to have the whole program as native C++ under /jni.</p>
  
  <p>It requires the use of Android NativeActivity - see for example:
  <a href="http://www.srombauts.fr/2011/03/01/android-2-3-nativeactivity" rel="nofollow noreferrer">http://www.srombauts.fr/2011/03/01/android-2-3-nativeactivity</a> and <a href="https://stackoverflow.com/questions/4372899/android-nativeactivity">Android NativeActivity</a> .</p>
  
  <p>For that, the /src is deleted, and also the AndroidManifest.xml is moved to the root of the project and modified accordingly:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.packtpub.program3D"
      android:versionCode="1"
      android:versionName="1.0" &gt;
  
      &lt;uses-feature android:glEsVersion="0x00020000"&gt;&lt;/uses-feature&gt;
      &lt;uses-sdk android:targetSdkVersion="15" android:minSdkVersion="15"&gt;&lt;/uses-sdk&gt;
  
      &lt;application
      android:icon="@drawable/ic_launcher"
      android:label="@string/app_name" &gt;
  
      &lt;activity android:name="android.app.NativeActivity"
          android:label="@string/app_name"&gt;
          &lt;meta-data android:name="android.app.lib_name"
              android:value="program3D"/&gt;
          &lt;intent-filter&gt;
              &lt;action android:name="android.intent.action.MAIN"/&gt;
              &lt;category
                  android:name="android.intent.category.LAUNCHER"/&gt;
          &lt;/intent-filter&gt;
      &lt;/activity&gt;
  
      &lt;/application&gt;
  &lt;/manifest&gt;
  </code></pre>
  
  <p>The "uses-feature" in AndroidManifest.xml must be specified for "glEsVersion" parameter as "0x00020000", otherwise NDK will use the default 1.0 version.</p>
  
  <p>In Android.mk, the program should have android_native_app_glue, including it as parameter to compile and build:</p>
  
  <pre><code>LOCAL_PATH := $(call my-dir)
  include $(CLEAR_VARS)
  LOCAL_MODULE    := program3D
  LOCAL_SRC_FILES := com_packtpub_program3D.c program3D.c
  LOCAL_LDLIBS    := -landroid -llog -lEGL -lGLESv1_CM
  LOCAL_STATIC_LIBRARIES := android_native_app_glue
  include $(BUILD_SHARED_LIBRARY)
  
  $(call import-module,android/native_app_glue)
  </code></pre>
  
  <p>The C/C++ code is placed in /jni/Main.cpp. Here you can access a template program useful for test purposes, which is placed in Main.cpp: <a href="http://developer.android.com/reference/android/app/NativeActivity.html" rel="nofollow noreferrer">http://developer.android.com/reference/android/app/NativeActivity.html</a> .</p>
  
  <p>Building and compiling gives no hitch, and just went fine. Here is the output:</p>
  
  <pre><code>**** Build of configuration Default for project program3D ****
  
  ndk-build NDK_DEBUG=1 V=1 all 
  rm -f ./libs/x86/lib*.so ./libs/armeabi/lib*.so ./libs/armeabi-v7a/lib*.so
  rm -f ./libs/x86/gdbserver ./libs/armeabi/gdbserver ./libs/armeabi-v7a/gdbserver
  rm -f ./libs/x86/gdb.setup ./libs/armeabi/gdb.setup ./libs/armeabi-v7a/gdb.setup
  Gdbserver      : [arm-linux-androideabi-4.4.3] libs/armeabi/gdbserver
  mkdir -p ./libs/armeabi
  install -p /opt/android/android-ndk-r7/toolchains/arm-linux-androideabi-4.4.3/prebuilt/gdbserver ./libs/armeabi/gdbserver
  Gdbsetup       : libs/armeabi/gdb.setup
  mkdir -p ./libs/armeabi
  echo "set solib-search-path ./obj/local/armeabi" &gt; ./libs/armeabi/gdb.setup
  echo "directory /opt/android/android-ndk-r7/platforms/android-14/arch-arm/usr/include /opt/android/android-ndk-r7/sources/android/native_app_glue /opt/android/android-ndk-r7/sources/cxx-stl/system/include jni" &gt;&gt; ./libs/armeabi/gdb.setup
  Install        : libprogram3D.so =&gt; libs/armeabi/libprogram3D.so
  mkdir -p ./libs/armeabi
  install -p ./obj/local/armeabi/libprogram3D.so ./libs/armeabi/libprogram3D.so
  /opt/android/android-ndk-r7/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-strip --strip-unneeded  ./libs/armeabi/libprogram3D.so
  
  **** Build Finished ****
  </code></pre>
  
  <p>Great! Right? Not exactly. </p>
  
  <p>When asked to run... it simply does not launch. Instead in LogCat only appears the following encryptic message and the program does not load or run in the device:</p>
  
  <pre><code> system_process : ThrottleSercie : unable to find stats for iface rmnet0
  </code></pre>
  
  <p>What can be missing, given the fact that the program debugged and compiled nicely.</p>
  
  <p>Someone may have any suggestion? All comments are highly appreciated.</p>