material-components / material-components/material-components-android
[LinearProgressIndicator] crash while inflating it in a worker thread
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 17.4k
- Forks
- 3.2k
- PR merge metrics
- No merged PRs in 30d
Description
Inflating a layout file in a worker thread will throw the following exception if the layout file contains a LinearProgressIndicator widget.
com.google.android.material:material:material 1.14.0-alpha04
```
Caused by: android.util.AndroidRuntimeException: Animators may only be run on Looper threads
at android.animation.ValueAnimator.end(ValueAnimator.java:1204)
at com.google.android.material.progressindicator.DrawableWithAnimatedVisibilityChange.endAnimatorsWithoutCallbacks(DrawableWithAnimatedVisibilityChange.java:330)
at com.google.android.material.progressindicator.DrawableWithAnimatedVisibilityChange.setVisibleInternal(DrawableWithAnimatedVisibilityChange.java:285)
at com.google.android.material.progressindicator.IndeterminateDrawable.setVisibleInternal(IndeterminateDrawable.java:149)
at com.google.android.material.progressindicator.DrawableWithAnimatedVisibilityChange.setVisible(DrawableWithAnimatedVisibilityChange.java:251)
at com.google.android.material.progressindicator.IndeterminateDrawable.setVisible(IndeterminateDrawable.java:38)
at com.google.android.material.progressindicator.DrawableWithAnimatedVisibilityChange.hideNow(DrawableWithAnimatedVisibilityChange.java:229)
at com.google.android.material.progressindicator.IndeterminateDrawable.hideNow(IndeterminateDrawable.java:38)
at com.google.android.material.progressindicator.BaseProgressIndicator.setIndeterminateDrawable(BaseProgressIndicator.java:424)
at com.google.android.material.progressindicator.LinearProgressIndicator.initializeDrawables(LinearProgressIndicator.java:137)
at com.google.android.material.progressindicator.LinearProgressIndicator.(LinearProgressIndicator.java:95)
at com.google.android.material.progressindicator.LinearProgressIndicator.(LinearProgressIndicator.java:88)
```
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with LinearProgressIndicator.java and follow initializeDrawables into BaseProgressIndicator.java, IndeterminateDrawable.java, and DrawableWithAnimatedVisibilityChange.java using the provided worker-thread inflation stack trace. Reproduce inflation of a layout containing LinearProgressIndicator from a worker thread; done means it no longer throws the reported AndroidRuntimeException.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, java
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100