Skip to content

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

@RafaRuiz

Description

@RafaRuiz

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions