Tuesday, 27 November 2018

ProviderInstaller doesn't work on emulators and catch error is not being read

In my application, I am connecting to an SSL server and in order to make it possible for API's less than 21 I need to install ProviderInstaller. Below is a preview of my code:

if (Build.VERSION.SDK_INT < 21) {
     try {
      ProviderInstaller.installIfNeeded(this);

    } catch (Exception e) {

      //Crashes the app when accessing the getMessage
      Log.i("error", e.getMessage());
   }
 }

This works well on device with API 16, but it doesnt work on emulators with API 16. And when I try to access the getMessage() error it crashes the whole application.

Why doesn't the ProviderInstaller.installIfNeeded(this) work on emulators, and also why does the application crashes when accessing the getMessage function?



from ProviderInstaller doesn't work on emulators and catch error is not being read

No comments:

Post a Comment