I’m using Firebase Realtime Database and Cloud Storage on my Android Things device. I have a rules defined as “allowed to read / write for everyone”. When I’m trying to write something there

final DatabaseReference log = mDatabase.getReference("logs").push();
            final StorageReference imageRef = mStorage.getReference().child(log.getKey());

            UploadTask task = imageRef.putBytes(imageBytes);
            task.addOnSuccessListener(new OnSuccessListener<UploadTask.TaskSnapshot>() {
                public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {
                    Uri downloadUrl = taskSnapshot.getDownloadUrl();
                    annotateImage(log, imageBytes);
            }).addOnFailureListener(new OnFailureListener() {
                public void onFailure(@NonNull Exception e) {

and I get Firebase error saying that I should sign In first.
Then I tried to sign In (previously created the user)

    mAuth.signInWithEmailAndPassword(email, password)
            .addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
                public void onComplete(@NonNull Task<AuthResult> task) {
                    if (task.isSuccessful()) {
                        // do my work
                    } else {
                        // handle error

But now it says:

com.google.firebase.FirebaseNetworkException: A network error (such as timeout, interrupted connection or unreachable host)

I have an internet on a device and it looks like it has the access to the firebase before saying that I need to sign in.

I’m using firebase core, storage, auth and database version of 16.

Any ideas how to solve this issue?