title: Android java.lang.RuntimeException: native typeface cannot be made
body: <p>I am getting the following exception when trying to set a custom font to a button: <code>java.lang.RuntimeException: native typeface cannot be made</code> 
  I already looked at similar questions but none of their solutions worked.</p>
  
  <p>My font is inside src/main and the file structure seems to be fine.</p>
  
  <p>Here is the file structure:</p>
  
  <p><a href="https://i.stack.imgur.com/2fbi6.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2fbi6.png" alt="enter image description here"></a></p>
  
  <p>And here is the code:</p>
  
  <pre><code>private void generateButtonListener(final Button btn,final String inputText) {
  
      btn.setTypeface(Typeface.createFromAsset(getAssets(), "rb.ttf"));
  
      btn.setOnClickListener(new android.view.View.OnClickListener() {
          public void onClick(View view1) {
              getCurrentInputConnection().commitText(inputText,1);
          }
  
      });
  
  
  }
  </code></pre>
  
  <p>Not sure if it matters but I am making a custom keyboard app so I am setting this listener on buttons in the <code>onCreateInputView</code> method. Like this:</p>
  
  <pre><code>   @Override
  public View onCreateInputView() {
  
      LayoutInflater lInflate = getLayoutInflater();
      Resources res = getResources();
      LinearLayout inputView = (LinearLayout) lInflate.inflate(R.layout.copypasta, null);
      Button tab_navySeal = (Button) inputView.findViewById(R.id.tab_navySeal);
    Button nSeal_1 = (Button) btnset_navyseal.findViewById(R.id.nSeal_1);
          generateButtonListener(nSeal_1, res.getString(R.string.NStxt));
  </code></pre>
  
  <p>etc...</p>
  
  <p>I seem to be following all the rules for fonts, what's the problem?</p>