Firebase Cloud Firestore : Invalid collection reference. Collection references must have an odd number of segments : <p>I have the following code and getting an error : </p>

<pre><code>Invalid collection reference. Collection references must have an odd number of segments
</code></pre>

<p><strong>And the code :</strong></p>

<pre><code>private void setAdapter() {
        FirebaseFirestore db = FirebaseFirestore.getInstance();
        db.collection("app/users/" + uid + "/notifications").get().addOnCompleteListener(task -&gt; {
            if (task.isSuccessful()) {
                for (DocumentSnapshot document : task.getResult()) {
                    Log.d("FragmentNotifications", document.getId() + " =&gt; " + document.getData());
                }
            } else {
                Log.w("FragmentNotifications", "Error getting notifications.", task.getException());
            }
        });
    }
</code></pre>
