Question: I want to use the same build.gradle files (project level and application level) for multiple projects. Right now I am accomplishing this by copying and pasting those files from an older project to a newer one. However, I would like to know an easier and less tedious way of going about this, such as perhaps importing gradle files from a certain directory and replacing the default versions.

Answer: 
If you're using transaction method, the error occurs if the user taps the button repeatedly (creating multiple transaction requests) and in a short time before the previous transaction finished.

I had the same problem and my solution in my app is by avoiding transaction method if the operation can be done in a short time.

Or you can disable the button and enable it when the previous transaction is finished or prevent the user from abusing the button.

```
private void onLikeButtonClicked() {
    likeButton.setEnabled(false);
    ref.runTransaction(new Transaction.Handler() {
        @Override
        public Transaction.Result doTransaction(MutableData mutableData) {
            // transaction operation 
            return Transaction.success(mutableData);
        }

        @Override
        public void onComplete(DatabaseError databaseError, boolean b,
                               DataSnapshot dataSnapshot) {
            likeButton.setEnabled(true);
        }
    });
}

```

I hope you understand my explanation, hope this helps :)
This happens when you enable persistent storage. And it seems they are yet to fix it. But if you disable persistent storage, you wont see this issue again.

```
//FirebaseDatabase.getInstance().setPersistenceEnabled(true);

```

Comment out this line and it will work. It happen as a result of corrupt database stored locally.