Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create an interactive Dice Roller app: Android Basics with Compose #157

Open
Ableez opened this issue Sep 11, 2024 · 1 comment
Open

Create an interactive Dice Roller app: Android Basics with Compose #157

Ableez opened this issue Sep 11, 2024 · 1 comment

Comments

@Ableez
Copy link

Ableez commented Sep 11, 2024

URL of codelab

In which task and step of the codelab can this issue be found?

Describe the problem

I'm getting syntax error on
var result by remember { mutableStateOf(1) }
@Composable invocations can only happen from the context of a @Composable function

Steps to reproduce?

  1. Go to...
  2. Click on...
  3. See error...

Versions
Android Studio version: Kaola 2024.1.2
API version of the emulator:

Additional information
Include screenshots if they would be useful in clarifying the problem.
image

@Bakr-Ali
Copy link

You are declaring the result and imageResource variables outside the composable DiceWithButtonAndImage function, they should be declared inside it. See solution

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants