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.

Espresso Idling when using Box<T>.put(T::class.java)

See original GitHub issue

Issue Basics

  • ObjectBox version (are using the latest version?): ANY (tried 1.2.1 and 1.4.4)
  • Reproducibility: ALWAYS

Reproducing the bug

Description

*Espresso is finding an idling when using Box<T>.put(T). I’m using a BoxStore as a Singleton and calling a box as: val box = RafaBoxStore.getInstance().getBoxFor(MyItem::class.java) then using box.put(T).

When running instrumented tests, the app won’t change the idle and Espresso will be waiting at least 45 seconds.*

    fun saveOrUpdateMyItem(product: ProductItem) {
        val box = RafaBoxStore.getInstance().getBoxFor(MyItem::class.java)
        if (isItemSavedInBox(product)) {
            addQuantityToProduct(product)
        } else {
            val myItem = MyItem()
            myItem.setProduct(product)
            box.put(myItem) /** THIS IS THE CASE **/
        }
    }

Logs & stackstraces

java.lang.RuntimeException: Could not launch intent Intent { flg=0x14000000 cmp=my.app.debug/my.app.debug.activities.ItemsActivity } within 45 seconds. Perhaps the main thread has not gone idle within a reasonable amount of time? There could be an animation or something constantly repainting the screen. Or the activity is doing network calls on creation? See the threaddump logs. For your reference the last time the event queue was idle before your activity launch request was 1522851145816 and now the last time the queue went idle was: 1522851145816. If these numbers are the same your activity might be hogging the event queue.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:13 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
RafaRuizcommented, May 1, 2018

Ok I can tell 100% what it was causing it now. I was adding products in my UI testing in order to be tested. I was faking image urls, and all urls failed. All image containers got a ProgressBar behind it, but my emulator doesn’t run animations, so ProgressBar wasn’t being shown but it was being tried to be redrawn.

Mind f**k.

Nothing to be with Object box, again, sorry.

1reaction
RafaRuizcommented, Apr 19, 2018

Hello @greenrobot, after a deep investigation, I checked that this doesn’t regard ObjectBox, I’m sorry for the waste of time 🙁.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Espresso idling resources - Android Developers
An idling resource represents an asynchronous operation whose results affect subsequent operations in a UI test. By registering idling ...
Read more >
Hello, espresso! Part 4 Working with Idling resources
Make your espresso test resilient by using idling resources to handle synchronization when needed.
Read more >
Android testing with Espresso's Idling Resources ... - Medium
Synchronizing your app with Espresso. If you know why you need Idling Resources, you can jump to the next section.
Read more >
Espresso: Thread.sleep( ) - android - Stack Overflow
I get a I/TestRunner: java.lang.NoClassDefFoundError: fr.x.app.y.testtools.ElapsedTimeIdlingResource error. Any idea. I use Proguard but with disable ...
Read more >
Espresso Idling Resource (UI Testing for Beginners PART 14)
This video is part of a FREE course: https://codingwithmitch.com/courses/ui-testing-for-beginners/In this video I show you how to use ...
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