title: Couchbase Cannot Write Document to Database
body: <p>I am a newbie on android and am trying to store image into database using couchbase mobile. When I try to run my code logcat outputs error "<em>Cannot write to database.The current winning revision is not deleted, so this is a conflict"</em>. I don't know what I am doing wrong. Any help would be much appreciated. Here is my code.</p>
  
  <pre><code>        Document document = database.getDocument("test1");
          Map&lt;String, Object&gt; docContent = new HashMap&lt;&gt;();
          docContent.put("message", "Hello Couchbase Lite");
          docContent.put("creationDate", currentTimeString);
          docContent.put("Testing Message 1","Testing the sync of message");
          try {
              document.putProperties(docContent);
              UnsavedRevision newRev = document.createRevision();
              URL url = new URL("res/mipmap-mdpi-v4/sym_def_app_icon.png");
              newRev.setAttachment("photo.png", "image/png", url);
              newRev.save();
              Log.d (TAG, "Document written to database named " + dbname + " with ID = " + document.getId());
              } 
          catch (CouchbaseLiteException e) {
              Log.e(TAG, "Cannot write document to database", e);
              }
          catch (MalformedURLException e) {
              e.printStackTrace();
          }
  </code></pre>