WorkManager is not initialized - android

I got this error on sentry panel only on production build variant.
IllegalStateException WorkManager is not initialized properly. You
have explicitly disabled WorkManagerInitializer in your manifest, have
not manually called WorkManager#initialize at this point, and your
Application does not implement Configuration.Provider.
java.util.concurrent.ThreadPoolExecutor in runWorker at line 1167
unlike the error i have no work manager dependency in project
could anyone help ...thanks in advance

Related

How do i resolve this warning junit5 throws when i run Parameterized tests?

I get this warning in my test console when i run test cases annotated with #ParameterizedTest
"org.junit.platform.launcher.core.InternalTestPlan add
WARNING: Attempt to modify the TestPlan was detected. A future version of the JUnit Platform will ignore this call and eventually even throw an exception. Please contact your IDE/tool vendor and request a fix (see https://github.com/junit-team/junit5/issues/1732 for details)."
How do i fix it?
According to the link in the error message, it would seem that:
IntelliJ IDEA is affected, fix is on its way: JetBrains/intellij-community#1030
Following that link, it seems that it should be fixed in the 2019.1 release of IntelliJ.

Test - FirebaseApp is not initialized in this process

I'm trying to run a test with Robolectric and it has an integration with Firebase. I have a project MyProject - Test that I'll be using to run the tests in a real instance of the database.
The problem is that, when running cleanup before test, I have the error:
java.lang.IllegalStateException: Default FirebaseApp is not initialized in this process null. Make sure to call FirebaseApp.initializeApp(Context) first.
at com.google.firebase.FirebaseApp.getInstance(Unknown Source)
at com.google.firebase.database.FirebaseDatabase.getInstance(Unknown Source)
at com.cgbros.silkhub.activity.listener.LoginActivityUnitTest.cleanUp(LoginActivityUnitTest.kt:26) <28 internal calls>
The test file:
https://gist.github.com/augustoerico/e88d3e5b59ae5d023d83c114b8ffa708
(I tried to copy-paste the source here. Failed miserably...)
Any insights on how I can make this work?
Thank you!
Ok, I've figured it out. It's actually a conceptual problem. The problem is that I'm trying to use the Firebase Android SDK to run a test outside of the Android context. I mean, my test is not an Android application, and I'm trying to use the Android SDK. All FirebaseApp.initializeApp() need a Context as a parameter.
So, what I have to do is to find a way to interact with my FirebaseDatabase. I think I can go with firebase-admin, or maybe use this one: https://github.com/bane73/firebase4j
Thank you for taking the time to help me (:
** Update **
I've opted to go with the Firebase REST API https://firebase.google.com/docs/reference/rest/database/
For future reference, I'm giving public full access, by tweaking the rules, so it is easier to write the tests setup and cleanup.
I've had the same problem and fixed it by initializing Firebase in the before step of my unit test:
FirebaseApp.initializeApp(InstrumentationRegistry.getInstrumentation().targetContext)
I also had the same issue a few day ago and i solve it in the same way the error says. You get that error because you're trying to get an instance of Firebase without initialize it. Please add this line of code before you try to get an instance of Firebase like this:
FirebaseApp.initializeApp(this);
Also, as Franks says, please be sure you have the following line of code added in your build.gradle file, as the last line of your entire file.
apply plugin: 'com.google.gms.google-services'
I used the most simple and straightforward approach.
Since you init your Firebase App in your Application, just create a variable there. For example,
//Your Application.class
open var isTestMode = false
onCreate(){
if(!isTestMode){
//Init your Firebase app
}
}
And then in Robolectric Application just extend your application and override the variable. In this case don't forget to provide configuration
#Config(application = TestApplication::class)
I also faced the above issue. Do all plugin download and checks by nuget. But in the end, I found the crashing was due to , Application Package Name not matching the one Assigned in Google Dev.
Application package name must matche the one that assigned in the Google Dev. Console
after add this line and then you get error
FirebaseApp.initializeApp(this);
then you have to do that also
add this line to Gradle (App)
apply plugin: 'com.google.gms.google-services'
add this line to Gradle (Project)
classpath 'com.google.gms:google-services:3.2.1'
also check if no dependncy is missing and make sure you add google-services.json

Can't native debug

I was able to use the native debug functionality until recently. I've been coding in java and went back to the native code but now I can't native debug. It will run and with the previously working debug config but I get a Null Pointer error on launch right when it would be attaching:
'Launching [debug config]' has encountered a problem.
An internal error occurred during 'Launching [debug config]'.
java.lang.NullPointerException
The app will run on the device, but won't hit breakpoints. Anyone seen this, it's driving me nuts?
Turns out this was due to the manifest "debuggable" being set to false. When you don't run native it tells you exactly that. With native, you get the absolutely useless error. I'll put in an enhancement request.

Adding a breakpoint in Eclipse, causes Dalvik to crash

This is an interesting bug of Eclipse. I am using:
Version: Indigo Release
Build id: 20110615-0604
Out of nowhere today, I set a breakpoint in my android app on Eclipse. When it reaches the code, debug (dalvik JVM) aborts and crashes:
Tried to execute code in unprepared class (followed by the class name)
If I don't set the break point, it will run through with no problem. I have searched through Google but found nothing so far.
Another note, where I set this breakpoint does not matter, it could simply be the 1st line of onClick() function, or anywhere else. The moment the app "pauses" due to the breakpoint, it crashes.
I run into the same issue; for me, the problem was solved by removing all of the watched expressions I had set up in the debugger (one of them was causing the problem).
I run into the same issue when used watch expression with static method of this (unprepared) class.
I solved this issue by removing this expression from expressions list.
I solved this issue by removing an unused import package.
actually the error message is saying "tried to execute code in unprepared class" (followed by the class name)
I am not using that class but it is imported.
Simply remove the import, and it works fine ....

Android Application class not found

In my application I use RoboGuice and the configuration for RoboGuice requires to add an Application-class and specify it in the AndroidManifest.xml file in the application-tag using the 'android:name' attribute.
So this is how my applicaiton-tag in the manifest looks like:
<application android:label="Worktime" android:icon="#drawable/logo" android:name=".guice.Application">
This always works and still does when I compile inside my IDE (IntelliJ) and deploy it to my device.
However when I want to run my tests using Ant (and only via Ant, this also still works in the IDE) I have this error on the console:
[exec] android.test.suitebuilder.TestSuiteBuilder$FailedToCreateTests:INSTRUMENTATION_RESULT: shortMsg=Unable to instantiate application eu.vranckaert.worktime.guice.Application: java.lang.ClassNotFoundException: eu.vranckaert.worktime.guice.Application in loader dalvik.system.PathClassLoader#44e88928
[exec] INSTRUMENTATION_RESULT: longMsg=java.lang.RuntimeException: Unable to instantiate application eu.vranckaert.worktime.guice.Application: java.lang.ClassNotFoundException: eu.vranckaert.worktime.guice.Application in loader dalvik.system.PathClassLoader#44e88928
This has worked before but started failing since I upgraded my 'Android SDK Tools' to revision 17 and the 'Android SDK Platform-tools' to revision 11.
Anyone who had this issue also or who knows how to fix it?
I think that the error saying
java.lang.ClassNotFoundException:
is occur only when you have create new class Activity and not declare(register) that in manifest file
please check if you have any new activity and not declare(register) that activity in manifest file
Thanks.
we might have encountered the same error - In my case the solution was to separate the Ant targets to two calls (i.e. "ant myParameters myTarget1 myTarget2", and "ant myParameters debug delivery"). Hope this works for you, anyhow - Google need to add better support for their undocumented/faulty changes (and stackoverflow isn't the best place for questions that are not originated in stupidity, as the lifetime of a complex question isn't too long here).

Categories

Resources