title: Attempt to invoke virtual method crash in AndroidPdfViewer
body: <p>Using the AndroidPdfViewer package. 
  My build.gradle code: </p>
  
  <pre><code>dependencies {
  implementation fileTree(dir: 'libs', include: ['*.jar'])
  implementation 'com.android.support:appcompat-v7:26.1.0'
  implementation 'com.android.support.constraint:constraint-layout:1.0.2'
  testImplementation 'junit:junit:4.12'
  androidTestImplementation 'com.android.support.test:runner:1.0.1'
  androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
  implementation("com.github.bumptech.glide:glide:4.5.0") {
      exclude group: "com.android.support"
  }
  implementation "com.android.support:support-fragment:26.1.0"
  compile 'com.github.barteksc:android-pdf-viewer:2.8.2'
  
  }
  </code></pre>
  
  <p>Activity XML file: </p>
  
  <pre><code>    &lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      xmlns:tools="http://schemas.android.com/tools"
      android:id="@+id/linearLayout"
      android:layout_width="match_parent"
      android:layout_height="match_parent"&gt;
  
      &lt;com.github.barteksc.pdfviewer.PDFView
          android:id="@+id/pdfView"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:layout_centerInParent="true"
          app:layout_constraintBottom_toBottomOf="parent"
          app:layout_constraintEnd_toEndOf="parent"
          app:layout_constraintStart_toStartOf="parent"
          app:layout_constraintTop_toTopOf="parent" /&gt;
  &lt;/android.support.constraint.ConstraintLayout&gt;
  </code></pre>
  
  <p>Activity code:</p>
  
  <pre><code>package eu.myapp.myapp;
  
  import android.support.v7.app.AppCompatActivity;
  import android.os.Bundle;
  
  import com.github.barteksc.pdfviewer.PDFView;
  
  public class activity_fact_sheet extends AppCompatActivity {
  
      PDFView pdfView;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
  
          PDFView pdfView = (PDFView) findViewById(R.id.pdfView);
          pdfView.fromAsset("file2.pdf").load();
      }
  }
  </code></pre>
  
  <p>file2.pdf located in app > src > main > assets</p>
  
  <p>Error on run:</p>
  
  <pre><code>01-18 11:59:25.475 29674-29674/eu.myapp.myapp E/AndroidRuntime: FATAL EXCEPTION: main
                                                                          Process: eu.myapp.myapp, PID: 29674
                                                                          java.lang.RuntimeException: Unable to start activity ComponentInfo{eu.myapp.myapp/eu.myapp.myapp.activity_fact_sheet}: java.lang.NullPointerException: Attempt to invoke virtual method 'com.github.barteksc.pdfviewer.PDFView$Configurator com.github.barteksc.pdfviewer.PDFView.fromAsset(java.lang.String)' on a null object reference
                                                                              at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2924)
                                                                              at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2985)
                                                                              at android.app.ActivityThread.-wrap14(ActivityThread.java)
                                                                              at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1635)
                                                                              at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                              at android.os.Looper.loop(Looper.java:154)
                                                                              at android.app.ActivityThread.main(ActivityThread.java:6692)
                                                                              at java.lang.reflect.Method.invoke(Native Method)
                                                                              at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1468)
                                                                              at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1358)
                                                                           Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'com.github.barteksc.pdfviewer.PDFView$Configurator com.github.barteksc.pdfviewer.PDFView.fromAsset(java.lang.String)' on a null object reference
                                                                              at eu.myapp.myapp.activity_fact_sheet.onCreate(activity_fact_sheet.java:17)
                                                                              at android.app.Activity.performCreate(Activity.java:6912)
                                                                              at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1126)
                                                                              at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2877)
                                                                              at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2985) 
                                                                              at android.app.ActivityThread.-wrap14(ActivityThread.java) 
                                                                              at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1635) 
                                                                              at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                                              at android.os.Looper.loop(Looper.java:154) 
                                                                              at android.app.ActivityThread.main(ActivityThread.java:6692) 
                                                                              at java.lang.reflect.Method.invoke(Native Method) 
                                                                              at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1468) 
                                                                              at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1358) 
  </code></pre>
  
  <p>Steps taken to resolve it:</p>
  
  <p>added <code>PDFView pdfView;</code> to activity code above <code>@Override</code> and under <code>public class activity_fact_sheet extends AppCompatActivity {</code>
  Also checked to see if it was an issue with my activity opening method (it wasn't).</p>
  
  <p>It seems the error is thrown on <code>pdfView.fromAsset("file2.pdf").load();</code> in the activity code. That makes it seem to me that it cannot find file2.pdf in the assets, but I'm probably wrong. </p>
  
  <p>The app crashes when you try to open the activity.</p>
  
  <p>Tried to implement it using <a href="https://www.youtube.com/watch?v=_NAE2lIcuM8" rel="nofollow noreferrer">this</a> video.</p>