question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

FlowManager not initialized while init method called.

See original GitHub issue

I did everything according to the guide: the libraries, the application onCreate method. I’ve got this error when running the app:

FATAL EXCEPTION: main                                                                                                                                                                                                                                                              
Process: tinkoff.androidcourse, PID: 2981                                                                                                                                                                                                                                          
java.lang.RuntimeException: Unable to start activity ComponentInfo{tinkoff.androidcourse/tinkoff.androidcourse.NavigationActivity}: java.lang.IllegalStateException: The global database holder is not initialized. Ensure you call FlowManager.init() before accessing the databas
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2665)                                                                                                                                                                                                  
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)                                                                                                                                                                                                   
    at android.app.ActivityThread.-wrap12(ActivityThread.java)                                                                                                                                                                                                                     
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477)                                                                                                                                                                                                        
    at android.os.Handler.dispatchMessage(Handler.java:102)                                                                                                                                                                                                                        
    at android.os.Looper.loop(Looper.java:154)                                                                                                                                                                                                                                     
    at android.app.ActivityThread.main(ActivityThread.java:6119)                                                                                                                                                                                                                   
    at java.lang.reflect.Method.invoke(Native Method)                                                                                                                                                                                                                              
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)                                                                                                                                                                                             
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)                                                                                                                                                                                                                
 Caused by: java.lang.IllegalStateException: The global database holder is not initialized. Ensure you call FlowManager.init() before accessing the database.                                                                                                                      
    at a.b.a.a.b.f.c(Unknown Source)                                                                                                                                                                                                                                               
    at a.b.a.a.b.f.b(Unknown Source)                                                                                                                                                                                                                                               
    at a.b.a.a.b.f.i(Unknown Source)                                                                                                                                                                                                                                               
    at a.b.a.a.b.f.a(Unknown Source)                                                                                                                                                                                                                                               
    at a.b.a.a.f.a.e.f(Unknown Source)                                                                                                                                                                                                                                             
    at a.b.a.a.f.a.e.a(Unknown Source)                                                                                                                                                                                                                                             
    at a.b.a.a.f.a.a.b(Unknown Source)                                                                                                                                                                                                                                             
    at a.b.a.a.f.a.d.b(Unknown Source)                                                                                                                                                                                                                                             
    at tinkoff.androidcourse.e.b(Unknown Source)                                                                                                                                                                                                                                   
    at tinkoff.androidcourse.e.a(Unknown Source)                                                                                                                                                                                                                                   
    at android.support.v4.b.l.b(Unknown Source)                                                                                                                                                                                                                                    
    at android.support.v4.b.r.a(Unknown Source)                                                                                                                                                                                                                                    
    at android.support.v4.b.r.d(Unknown Source)                                                                                                                                                                                                                                    
    at android.support.v4.b.r.a(Unknown Source)                                                                                                                                                                                                                                    
    at android.support.v4.b.f.c(Unknown Source)                                                                                                                                                                                                                                    
    at android.support.v4.b.r.b(Unknown Source)                                                                                                                                                                                                                                    
    at android.support.v4.b.r.a(Unknown Source)                                                                                                                                                                                                                                    
    at android.support.v4.b.r.b(Unknown Source)                                                                                                                                                                                                                                    
    at android.support.v4.b.r.f(Unknown Source)                                                                                                                                                                                                                                    
    at android.support.v4.b.o.o(Unknown Source)                                                                                                                                                                                                                                    
    at android.support.v4.b.m.onStart(Unknown Source)                                                                                                                                                                                                                              
    at android.support.v7.app.e.onStart(Unknown Source)                                                                                                                                                                                                                            
    at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1248)                                                                                                                                                                                                  
    at android.app.Activity.performStart(Activity.java:6696)                                                                                                                                                                                                                       
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2628)                                                                                                                                                                                                  
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)                                                                                                                                                                                                   
    at android.app.ActivityThread.-wrap12(ActivityThread.java)                                                                                                                                                                                                                     
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477)                                                                                                                                                                                                        
    at android.os.Handler.dispatchMessage(Handler.java:102)                                                                                                                                                                                                                        
    at android.os.Looper.loop(Looper.java:154)                                                                                                                                                                                                                                     
    at android.app.ActivityThread.main(ActivityThread.java:6119)                                                                                                                                                                                                                   
    at java.lang.reflect.Method.invoke(Native Method)                                                                                                                                                                                                                              
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)                                                                                                                                                                                             
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)                                                                                                                                                                                                                                                                                                                                                                                                               

DBFlow:4.0.2 Gradle:2.3.2 buildToolsVersion:25.0.3

Application class is added to manifest.

public class App extends Application {

    @Override
    public void onCreate() {
        super.onCreate();
        PrefManager.newInstance(this);
        FlowManager.init(this);
    }
}

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:2
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

7reactions
goto1134commented, May 24, 2017

I found the solution!!! it was all about proguard rules. Please, write about it on the main page. It should be more noticable.

2reactions
azizkayumovcommented, Aug 24, 2017

I am having the same issue: My application class contains: FlowManager.init(new FlowConfig.Builder(applicationContext) .openDatabasesOnInit(true) .build()); FlowLog.setMinimumLoggingLevel(FlowLog.Level.V);

My database: @Database(name = PagerDatabase.NAME, version = PagerDatabase.VERSION) public class PagerDatabase { public static final String NAME = "PagerDatabase"; public static final int VERSION = 1; }

My table: @Table(database = PagerDatabase.class) public class PagerContact extends BaseModel{ @Column @SerializedName("id") @Expose private Long id; @Column @PrimaryKey @SerializedName("account_id") @Expose private Long accountId; ........

I added the following to proguard: -keep class * extends com.raizlabs.android.dbflow.config.DatabaseHolder { *; } -keep class net.sqlcipher.** { *; } -dontwarn net.sqlcipher.**

When I try to save any object, it gives me: java.lang.RuntimeException: java.lang.IllegalStateException: The global database holder is not initialized. Ensure you call FlowManager.init() before accessing the database. Is there anything I am missing? Thanks beforehand.

Read more comments on GitHub >

github_iconTop Results From Across the Web

java.lang.IllegalStateException: The global database holder is ...
Ensure you call FlowManager.init() before accessing the database? ... IllegalStateException: The global database holder is not initialized.
Read more >
com.raizlabs.android.dbflow.config.FlowManager.init java code ...
How to use. init. method. in. com.raizlabs.android.dbflow.config.FlowManager ... then we need to initialize the module as part // of the creation process.
Read more >
com.raizlabs.android.dbflow.config.FlowManager#init
This page shows Java code examples of com.raizlabs.android.dbflow.config.FlowManager#init.
Read more >
Getting Started - DBFlow - GitBook
Initialize FlowManager. DBFlow currently needs an instance of Context in order to use it for a few features such as reading from assets,...
Read more >
The 'init=' Method — Chapel Documentation 1.29
In order to rectify these issues, a new method named “init=” has been created to ... If those initializers were invoked when initializing...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found