Q:

Android NDK app won't run

I've been trying to get started on adding native code to my android app so I've looked through a plethora of Android NDK tutorials all to no avail. I can't get any of the apps to run on my emulator or my Galaxy S3. I keep getting the same error: "Unfortunately, [AppName] has stopped working"
My ndk-build command works successfully and I get a .so file. I don't know what the .so file is supposed to look like. Here's mine 
http://txt.do/klo0
it looks like gibberish to me but what do I know?
This is my logcat
http://txt.do/klod

A:

In the Android NDK directory, there is a hello-jni example. Try to compile and run it, it works.
It's in the samples/hello-jni directory of your NDK, I have it in ~/android-ndk-r9d/samples/hello-jni. Copy ("import") it into your workspace and compile.
To generate the headers:
cd bin/classes
javah com.my.package.name.MyClassName

Note that the library is usually placed by ndk-build into the libs/something subdirectory of your project, for example, libs/armeabi-v7a, and the file jni/Application.mk specifies what something is, e.g.
APP_ABI := armeabi-v7a

or
APP_ABI := all

The library will be placed in your apk and installed in a subdirectory of your application's data folder.
System.loadLibrary("stuff"); // libstuff.so

will find it.  (Note that if you run your app as a system app, that's a different story.)
A library built for a wrong target will not work.

