Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loading schema failed: 500 No DB catalog present #629

Closed
flutter-youni opened this issue Dec 18, 2018 · 6 comments
Closed

Loading schema failed: 500 No DB catalog present #629

flutter-youni opened this issue Dec 18, 2018 · 6 comments
Labels
more info required Further information is requested

Comments

@flutter-youni
Copy link

flutter-youni commented Dec 18, 2018

  • Using ObjectBox 2.2.0-2018-09-27 (2.2.0-2018-09-27 (32 bit))

If I remove the .directory(sPath) everything works fine

  classpath 'io.objectbox:objectbox-gradle-plugin:2.2.0'
private void initGreenDao() {
        Method method = getBuildMethod();
        try {
            BoxStoreBuilder boxStoreBuilder = (BoxStoreBuilder) method.invoke(sClass);
            sBoxStore = boxStoreBuilder.androidContext(
                    BaseApplication.getAppContext()).directory(sPath).build();
            if (BuildConfig.DEBUG) {
                boolean isDebug = BoxStore.isObjectBrowserAvailable();
                if (BuildConfig.DEBUG) {
                    new AndroidObjectBrowser(sBoxStore)
                            .start(BaseApplication.getAppContext());
                }
            }
        } catch (Exception exception) {
            exception.printStackTrace();
            LogUtil.error(TAG, "BoxStoreBuilder调用invoke异常 : " + LogUtil.getStackTrace(exception));
        }
    }

wx20181218-134235 2x

@greenrobot
Copy link
Member

Does the app itself work using .directory(sPath) ? Is the path valid?

@greenrobot-team
Copy link
Member

greenrobot-team commented Jan 7, 2019

Just tried this using our example and it works fine:

File customDirectory = new File(getFilesDir(), "exdb");
boolean created = customDirectory.mkdir() || customDirectory.isDirectory();
if (!created) {
    throw new RuntimeException("Could not create directory " + customDirectory);
}
boxStore = MyObjectBox.builder().androidContext(App.this).directory(customDirectory).build();

As suggested, check if your sPath directory is actually created and is a directory.

edit: also, update to 2.3.0.
-ut

@greenrobot-team greenrobot-team added the more info required Further information is requested label Jan 7, 2019
@greenrobot-team
Copy link
Member

Potential duplicate of #487. -ut

@greenrobot-team
Copy link
Member

Closing this issue due to inactivity. 💤 Please re-open with more details or submit a new issue.

@whatshappen
Copy link

Code:
val file = File(SDCardUtils.getSDCardPathByEnvironment() + "/CustomFile/dbFile")
if (!file.exists()) {
file.exists()
}
MyObjectBox.builder()
.androidContext(context.applicationContext)
.directory(file)
.build()
Error:
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3909)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4062)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:101)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2415)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:211)
at android.os.Looper.loop(Looper.java:300)
at android.app.ActivityThread.main(ActivityThread.java:8401)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:559)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:954)
Caused by: java.lang.IllegalStateException: No DB catalog present
at io.objectbox.BoxStore.nativeCreateWithFlatOptions(Native Method)
at io.objectbox.BoxStore.(BoxStore.java:271)
at io.objectbox.BoxStoreBuilder.build(BoxStoreBuilder.java:591)

@greenrobot-team
Copy link
Member

@whatshappen I answered in #1169.

For all others, see the comment in #865 for potential solutions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
more info required Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants