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.

Jetpack Compose projects unable to click if calling `Beagle.imprint`

See original GitHub issue

This is our internal/private project, will try to create new or simple project for this case and update this issue hopefully to try/clone as a reproducible samples 🙏

Context:

When trying to call the Beagle.imprint (we’re still using Beagle v1.x) the Jetpack Compose click handler gone (unable to click any composable functions)

    Beagle.imprint(
        application = this,
        appearance = Appearance(
            themeResourceId = R.style.AppTheme
        ),
        behavior = Behavior(
            shouldResetPendingChangesOnClose = true
        )
    )

Commenting out the above code, as workaround to make our composable function able to click, in exchange to prevent beagle to be shown 😦

Information:

Compose: 1.0.1
Kotlin: 1.5.21
AGP: 4.2.2
Gradle: 7.1.1
IntelliJ IDEA 2021.2.1 RC (Community Edition)
Build #IC-212.5080.39, built on August 19, 2021
Runtime version: 11.0.11+9-b1504.16 aarch64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 11.3
GC: G1 Young Generation, G1 Old Generation
Memory: 4096M
Cores: 8
Non-Bundled Plugins: com.codestream.jetbrains-codestream (11.0.12+180)
Kotlin: 212-1.5.10-release-IJ5080.39

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
mochadwicommented, Aug 30, 2021

will try to update the beagle to latest version instead, and retry to use it with Compose 🙏 thanks for the insight!

upgrading to latest version fixed the issue

1reaction
pandulapetercommented, Aug 25, 2021

Hi,

So sorry for the late answer, I’m having a crazy week.

First of all, I STRONGLY recommend you migrate to the latest version of Beagle, I’m honestly surprised you don’t get build errors for 1.x. Here is a gist that should contain all the code you need. Or feel free to follow the steps described in the main readme of this repo, I promise it won’t take longer than 10 minutes.

However, I’m not 100% sure this will fix your issue. Beagle injects a Fragment on top of your view hierarchy that SHOULD forward all of the touch events to your app Views underneath, however, this was never tested with Compose. Please give it a try as I won’t have time to look at it before the weekend. Another idea would be to use the dialog artifact (instead of the drawer one) - again, you can only do this after version 2.x (from Gradle).

Theoretically Compose click handling should be compatible with the old View system as you can use ComposeView as part of your normal layout hierarchy. If the above steps don’t fix the issue, hopefully this should be a simple fix + quick library update on my side.

Thanks for reporting the issue!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Jetpack Compose - Click of button doesn't work each time
Problem is that when I click the "Pray to God" button. The code that it calls works only odd times. For example, first...
Read more >
Testing your Compose layout - Jetpack - Android Developers
You should verify that the state of your Compose elements is correctly restored when the activity or process is recreated. It's possible to...
Read more >
Pass an On-Click Event to a Function in Android Jetpack ...
While choosing the template, select Empty Compose Activity. If you do not find this template, try upgrading the Android Studio to the latest ......
Read more >
Dealing with flaky tests in Jetpack Compose | by Igor Escodro
Now we are delegating the creation of the Composable to the initComposable function that is called on each test. Simple and clean. When...
Read more >
Adding AlertDialog with Jetpack Compose to Android apps
Then, click Finish, and a new Jetpack Compose project will be created. ... If you have an existing Android project, you must add...
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