Its hard to get started. I am using “implementation ‘com.couchbase.lite:couchbase-lite-android:2.6.0’”
I am supposed to evaluate this tech, but I can’t seem to get to square one…
Any suggestion is appreciated.
From what I read from the docs the following should work. But the new Database( dbname, config) fails
dbname is “salesfloor”
And while I am new to Android development, as an old Java guy, I would have thought the exception would have been caught (but alas no, the app just exits).
public void initCouchbaseLite(Context context) {
CouchbaseLite.init(context);
appContext = context;
}
// -------------------------
// Database operation
// -------------------------
private void openDatabase(String dbname) {
DatabaseConfiguration config = null;
try {
initCouchbaseLite(getApplicationContext());
config = new DatabaseConfiguration();
} catch ( Exception e1 ) {
setStatus( e1.getMessage() );
}
// config.setDirectory(String.format("%s/%s", appContext.getFilesDir(), dbname));
try {
database = new Database(dbname, config);
} catch (Exception e) {
setStatus(e.getMessage());
}
int i = 0;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
setStatus(“Not Connected”);
findViewById(R.id.sync).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
startSession(DATABASE_NAME, DATABASE_NAME);
}
});
}