Support Topics Documentation Slack YouTube Blog

Crash showing in google play console

Hi Guys I am getting this crash - it is shown on the Android Vitals page of the google play console.

I have no idea how to debug or find this and there is no clue in the trace which call to backendless in my code is calling this. Can you help?!

Today, 00:58 on app version 45

Samsung Galaxy S9 (starlte), Android 9

Report 1 of 3

java.lang.ExceptionInInitializerError :

at com.backendless.HeadersManager.getInstance (HeadersManager.java:38)

at com.backendless.Invoker.invokeSync (Invoker.java:95)

at com.backendless.Invoker$1.run (Invoker.java:71)

at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1167)

at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:641)

at java.lang.Thread.run (Thread.java:764)

Caused by: java.lang.IllegalStateException :

at com.backendless.AndroidBackendlessPrefs.getAuthKeys (AndroidBackendlessPrefs.java:119)

at com.backendless.AndroidBackendlessPrefs.getApplicationId (AndroidBackendlessPrefs.java:50)

at com.backendless.Backendless.getApplicationId (Backendless.java:248)

at com.backendless.AndroidHeadersManager. (AndroidHeadersManager.java:34)

at com.backendless.AndroidHeadersManager.getInstance (AndroidHeadersManager.java:22)

at com.backendless.HeadersManager. (HeadersManager.java:28)

Hi Mike,

didn’t you miss to call Backendless.initApp(...) first?

Stanislaw

Hi Stanislaw

It is there in onCreate in the home activity class. Does that not cover it? or should it placed somewhere else?

I never get an error when testing on my development device so was surprised to see this, but it has cropped up a few times now on android vitals.

Mike

Don’t know where is the best place to put it in android code, but it should be called before any using of Backendless SDK. If home activity class is this place, then put it there.

Stanislaw

So your best guess is that this might be caused by not calling backendless.init before a backendless call? In which case I will go through all backendless calls and ensure that backendless must have been initialised. (which I think is the status quo already)

Perhaps it is on some sort of wakeup call or a scenario like that which I haven’t stumbled upon in testing. In ios we put it in app delegate as per docs, but android docs don’t specify an optimum place to put the init call so I am guessing onCreate() is satisfactory ???

Yes, try in onCreate

Hi @mike-turner

The best place to initialize the Backendless is your Application class.
Put Backendless.initApp() into onCreate() method of your Application.

Best Regards,
Maksym

Thanks guys, but that is where it is already.

Make sure that you initialize the Backendless in the Application, not the Activity.
There may be some cases when the.home activity is not launched by default.

If you follow the stack trace, you can discover that the app throws the IllegalStateException with message "Backendless application was not initialized". And the exception is thrown in AndroidBackendlessPrefs class, when it tries to get authKeys, that should be received from initApp() method.
So it’s indeed the Backendless initialization problem.

Got you, thanks that makes sense now. Thanks

You are welcome!)