title: Attempt to invoke virtual method 'android.content.res.AssetManager android.content.res.Resources.getAssets()' on a null object reference
body: <h2>What is happening:</h2>
  
  <ol>
  <li>I have a stacktrace from the appstore as below, problem i am facing
  is that it dosen't show which class has caused this crash.</li>
  <li>what i can understand is that its causing due to the assets that i
  have used</li>
  <li>Only place i am using assets is at the application level to set the
  font</li>
  </ol>
  
  <h2>Code:</h2>
  
  <pre><code>private void setDefaultFont() {
  
          try {
              final Typeface bold = Typeface.createFromAsset(getAssets(), "fonts/OpenSans-Bold.ttf");
              final Typeface italic = Typeface.createFromAsset(getAssets(), "fonts/OpenSans-Italic.ttf");
              final Typeface boldItalic = Typeface.createFromAsset(getAssets(), "fonts/OpenSans-BoldItalic.ttf");
              final Typeface regular = Typeface.createFromAsset(getAssets(),"fonts/OpenSans-Regular.ttf");
  
              Field DEFAULT = Typeface.class.getDeclaredField("DEFAULT");
              DEFAULT.setAccessible(true);
              DEFAULT.set(null, regular);
  
              Field DEFAULT_BOLD = Typeface.class.getDeclaredField("DEFAULT_BOLD");
              DEFAULT_BOLD.setAccessible(true);
              DEFAULT_BOLD.set(null, bold);
  
              Field sDefaults = Typeface.class.getDeclaredField("sDefaults");
              sDefaults.setAccessible(true);
              sDefaults.set(null, new Typeface[]{
                      regular, bold, italic, boldItalic
              });
  
          } catch (NoSuchFieldException e) {
             // logFontError(e);
          } catch (IllegalAccessException e) {
             // logFontError(e);
          } catch (Throwable e) {
              //cannot crash app if there is a failure with overriding the default font!
             // logFontError(e);
          }
      }
  </code></pre>
  
  <h2>StackTrace from Appstore:</h2>
  
  <pre><code>java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.res.AssetManager android.content.res.Resources.getAssets()' on a null object reference
  at android.app.LoadedApk.getAssets(LoadedApk.java:528)
  at android.app.LoadedApk.makeApplication(LoadedApk.java:584)
  at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4526)
  at android.app.ActivityThread.access$1500(ActivityThread.java:151)
  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1364)
  at android.os.Handler.dispatchMessage(Handler.java:102)
  at android.os.Looper.loop(Looper.java:135)
  at android.app.ActivityThread.main(ActivityThread.java:5254)
  at java.lang.reflect.Method.invoke(Native Method)
  at java.lang.reflect.Method.invoke(Method.java:372)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
  </code></pre>
  
  <h2>What approach should i need to take to resolve this??</h2>