I have some problems with my Native Activity application. It works fine on 99% of devices. But sometimes users get the following error:
java.lang.RuntimeExceptio
You will need to read the logcat output to see what happened prior to the crash, which prevented the native library from loading. I use Acra for my apps (generates crash reports containing logcat output), but as a quick solution to get the logcat output without implementing a whole crash reporting system, you could use something like this in a test build, and have the user run it:
try
{
Process process = Runtime.getRuntime().exec( "logcat -d" );
BufferedReader bufferedReader = new BufferedReader(
new InputStreamReader( process.getInputStream() ) );
StringBuilder log = new StringBuilder();
String line = "";
while( ( line = bufferedReader.readLine() ) != null ) {
log.append( line );
}
// Output available via log.toString().. do whatever with it
}
catch( IOException e ) {}
If you look at the source code for NativeActivty, this exception you are seeing gets thrown in the onCreate() method (see line 171), so if you override that method in a derived class of NativeActivity, you can catch it and grab the logcat output from there. Then you could save the log to a file and have a user with an affected device run the test and email the file to you, for example.
Another good thing about overriding onCreate(), is it will also allow you to reproduce some of what goes on behind the scenes, with more debug logging to help you track down the problem.