Caused by: java.lang.RuntimeException: Failed to load storage. Resource: services/com.couchbase.lite.storage.SQLiteStorageEngine classname:

150 views
Skip to first unread message

John Bibal III

unread,
Aug 12, 2014, 3:09:23 AM8/12/14
to mobile-c...@googlegroups.com
Hi,

I am getting a "Failed to load storage" Error.

Any idea on how to fix this?


Thanks,

John


Message has been deleted

John Bibal III

unread,
Aug 12, 2014, 3:11:30 AM8/12/14
to mobile-c...@googlegroups.com
This happens when I try to initialize the Couchbase lite database.

// create a new database
database = null;
try {
    database = manager.getDatabase(DATABASE_NAME);
    Log.d (TAG, "Database created");
} catch (CouchbaseLiteException e) {
    Log.e(TAG, "Cannot get database");
    return;

Gyula Vörös

unread,
Aug 13, 2014, 11:31:26 PM8/13/14
to mobile-c...@googlegroups.com
Hey,

Same here. Do you have any update? I tried with

compile group: 'com.couchbase.lite', name: 'couchbase-lite-android', version: '0.0.0-436'
&
compile group: 'com.couchbase.lite', name: 'couchbase-lite-android', version: '1.0.1'

no luck so far.

I see the file in the projects build folder: /build/intermediates/exploded-aar/com.couchbase.lite/couchbase-lite-android/0.0.0-436/classes.jar!/services/com.couchbase.lite.storage.SQLiteStorageEngine, but get "Failed to load storage.  Resource: services/com.couchbase.lite.storage.SQLiteStorageEngine classname:".

Traun Leyden

unread,
Aug 14, 2014, 1:39:55 PM8/14/14
to mobile-c...@googlegroups.com

Are you using Eclipse + maven artifacts?

That's an untested configuration, so I'm not sure that it will work or not.  Can you try with Android Studio or are you required to use Eclipse?

For Eclipse users, we are recommending a different approach to adding the dependencies:





--
You received this message because you are subscribed to the Google Groups "Couchbase Mobile" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mobile-couchba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mobile-couchbase/a80e9300-fd6c-4148-8b09-00b50f5b9ac2%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Gyula Vörös

unread,
Aug 14, 2014, 1:56:28 PM8/14/14
to mobile-c...@googlegroups.com
The environment is the following:

IDE: Android Studio 0.8.6.
Build tools: com.android.tools.build:gradle:0.12.+
Couchbase: compile group: 'com.couchbase.lite', name: 'couchbase-lite-android', version: '0.0.0-436'

DB init code:
final Manager manager = new Manager(new AndroidContext(context), Manager.DEFAULT_OPTIONS);
final Database database = manager.getDatabase("myapp-db");


--
You received this message because you are subscribed to a topic in the Google Groups "Couchbase Mobile" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/mobile-couchbase/I91La6UQ9Yg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to mobile-couchba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mobile-couchbase/CACSSHCGvz4UDJPHv6aX%3D_4LCFe5mKpgYXFzfkGnMKf4pxibGfA%40mail.gmail.com.

Traun Leyden

unread,
Aug 14, 2014, 1:58:28 PM8/14/14
to mobile-c...@googlegroups.com
Can you try with TodoLite-Android and see if you get the same error?

The latest Android Studio I've tested with is 0.8.2.




Gyula Vörös

unread,
Aug 14, 2014, 3:29:04 PM8/14/14
to mobile-c...@googlegroups.com
Ok, I found out what was the problem, it has nothing to do with the build tools, or the dev environment. I tried to init the Database in an Android Service. It's really strange, because I'm using the exact same context (Application Context), it should be running on the main thread, so I not see the difference between calling the init code in the Application's onCreate or a Services' onCreate method. I even tried to use a handler to post a Runnable and make sure that it's running on the main thread. In the SQLiteStorageEngineFactory there is a line:

InputStream inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream(resource);

It returns null, maybe the issue related to how the Android class loader works.


Reply all
Reply to author
Forward
0 new messages