title: Sqlcipher __ CREATE TABLE android_metadata failed
body: <p>I'm trying to attach a existing sqlcipher database(encrypted) in my android application but after copying it in my directory it cannot be opened using "SQLiteDatabase.openDatabase(...)"</p>
  
  <p>I tried the code in normal sqlite and it works correctly but when I used sqlcipher API i got this error message </p>
  
  <pre><code> //CREATE TABLE android_metadata failed
   //Failed to setLocale() when constructing, closing the database
   // net.sqlcipher.database.SQLiteException: file is encrypted or is not a database
  </code></pre>
  
  <p>I used the following code inside SQLiteOpenHelper Class :</p>
  
  <pre><code>      if(!dbExist1)
        {
  
              this.getWritableDatabase(password);
              this.openDatabase();
              try
              {
                    this.close();    
                    copyDataBase();
              }
              catch (IOException e)
              {
  
                    throw new Error("Error copying database");
              }
        }
  
  
          public SQLiteDatabase openDatabase() throws SQLException {
      String DBPath = DATABASE_PATH + DATABASE_NAME;
  
      myDataBase = SQLiteDatabase.openDatabase(DBPath, password, null,
              SQLiteDatabase.NO_LOCALIZED_COLLATORS);
      return myDataBase;
  }
  </code></pre>
  
  <p>And I used the following code inside Activity Class :</p>
  
  <pre><code>  SQLiteDatabase.loadLibs(this);
   DataBaseHelper myDbHelper ;
        myDbHelper = new DataBaseHelper(this);
    SQLiteDatabase db=myDbHelper.openDatabase();
  </code></pre>
  
  <p>i tried  to use <a href="https://stackoverflow.com/questions/13537073/android-sqlcipher-pragma-problems">this solution</a> but still same error </p>
  
  <blockquote>
    <p>Blockquote</p>
  </blockquote>