Exception does not catching in try..catch(Exception ex)

345 views Asked by At

Testing presence of videeditor_jni Native Library in system libraries by

static {
    try {
        if (System.getProperty("videoeditor_jni") != null) {
            System.loadLibrary("videoeditor_jni");
        } else {
            PreferenceManager.setLibraryFlag(false);

        }
    } catch (Exception e) {
        PreferenceManager.setLibraryFlag(false);
    }

}

while running this code i've got UnsatisfiedException on library in logcat. though I've put conditions and try..catch it is checking if condition and then Force Close. why didn't go into catch?? any reason? tried UnsatisfiedException, RuntimeException, Exception, Error but not anything called in catch.. need help .

1

There are 1 answers

5
Praveen Sharma On

To Catch exception stackTrace use method printStackTrace(). like as belows

write this Application class onCreate method.

public void onCreate()
    {
super.onCreate();
....

        try {
            if (System.getProperty("videoeditor_jni") != null) {
                System.loadLibrary("videoeditor_jni");
            } else {
                PreferenceManager.setLibraryFlag(false);

            }
        } catch (Exception e) {
          e.printStackTrace.
        }

    }