Firebase Storage - StorageReference.getFile() crashes when device is offline
<p>When I try to download file from Firebase Storage by using method <a href="https://firebase.google.com/docs/reference/android/com/google/firebase/storage/StorageReference.html#getFile(java.io.File)" rel="nofollow"><code>StorageReference.getFile(File)</code></a> it crashes when device is offline and timeout is reached. Logcat shows NPE in DynamicModulesC:</p>

<pre><code>java.lang.NullPointerException: null reference
at asn.a(:com.google.android.gms.DynamiteModulesC:27)                                                                                     
</code></pre>

<p>The same code works properly and file is downloaded when internet connection is available. I've tested it on devices and emulators with Android 4.1 and 6.0. Firebase SDK version 9.6.1.
Is this a bug in firebase SDK? Did I miss something?</p>

<p>Code simple:</p>

<pre><code>FirebaseStorage firebaseStorage = FirebaseStorage.getInstance();
//firebaseStorage.setMaxDownloadRetryTimeMillis(15 * 1000);
StorageReference remoteDir= firebaseStorage.getReference().child("dir-with-files");
File destinationFile= new File("file-in-app-internal-storage");
StorageReference fileRef = remoteDir.child("file-from-firebase");
fileRef.getFile(destinationFile);
</code></pre>

<p>Full crash log:</p>

<pre><code>10-02 10:49:57.577 9429-9464/com.github.lecho.mobilization W/System: ClassLoader referenced unknown path: /system/priv-app/PrebuiltGmsCore/lib/x86_64
10-02 10:49:57.610 9429-9464/com.github.lecho.mobilization I/DynamiteModule: Considering local module com.google.android.gms.firebasestorage:0 and remote module com.google.android.gms.firebasestorage:1
10-02 10:49:57.610 9429-9464/com.github.lecho.mobilization I/DynamiteModule: Selected remote version of com.google.android.gms.firebasestorage, version &gt;= 1
10-02 10:49:57.628 9429-9464/com.github.lecho.mobilization W/System: ClassLoader referenced unknown path: /data/user/0/com.google.android.gms/app_chimera/m/00000002/n/x86_64

10-02 10:50:11.599 9429-9462/com.github.lecho.mobilization W/ExponenentialBackoff: network unavailable, sleeping.
10-02 10:50:11.599 9429-9462/com.github.lecho.mobilization E/StorageUtil: error getting token java.util.concurrent.ExecutionException: com.google.firebase.FirebaseApiNotAvailableException: firebase-auth is not linked, please fall back to unauthenticated mode.
10-02 10:50:12.234 9429-9464/com.github.lecho.mobilization W/ExponenentialBackoff: network unavailable, sleeping.
10-02 10:50:12.234 9429-9464/com.github.lecho.mobilization E/StorageUtil: error getting token java.util.concurrent.ExecutionException: com.google.firebase.FirebaseApiNotAvailableException: firebase-auth is not linked, please fall back to unauthenticated mode.

                                                                      --------- beginning of crash
10-02 10:50:12.236 9429-9464/com.github.lecho.mobilization E/AndroidRuntime: FATAL EXCEPTION: FirebaseStorage-Download-3
                                                                         Process: com.github.lecho.mobilization, PID: 9429
                                                                         java.lang.NullPointerException: null reference
                                                                             at asn.a(:com.google.android.gms.DynamiteModulesC:27)
                                                                             at bul.d(:com.google.android.gms.DynamiteModulesC:261)
                                                                             at buf.onTransact(:com.google.android.gms.DynamiteModulesC:76)
                                                                             at android.os.Binder.transact(Binder.java:387)
                                                                             at com.google.android.gms.internal.zzans$zza$zza.aE(Unknown Source)
                                                                             at com.google.android.gms.internal.zzanv.aE(Unknown Source)
                                                                             at com.google.firebase.storage.FileDownloadTask.run(Unknown Source)
                                                                             at com.google.firebase.storage.StorageTask$5.run(Unknown Source)
                                                                             at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
                                                                             at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
                                                                             at java.lang.Thread.run(Thread.java:818)
10-02 10:50:12.237 1540-1997/system_process W/ActivityManager:   Force finishing activity com.github.lecho.mobilization/.ui.MainActivity

                                                           [ 10-02     10:50:12.246  1540: 1997 D/         ]
                                                           HostConnection::get() New Host Connection established 0x7f39f896fc00, tid 1997
</code></pre>