setVisibility error in Android P: method can only be called from the same library group
Hi everyone! I'm developing an Android app in Kotlin and encountered a very strange error when trying to hide or show a `VisibilityAwareImageButton` on Android 9 (Pie).
I have a simple code snippet:
```kotlin
class MyFragment : Fragment() {
private lateinit var myButton: VisibilityAwareImageButton
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
myButton = view.findViewById(R.id.my_button)
// Trying to hide the button
myButton.visibility = View.GONE
}
}
```
When running on Android 9 (API 28), I get an exception:
```
java.lang.RuntimeException: VisibilityAwareImageButton.setVisibility can only be called from the same library group (groupI
```
No answers yet.
Log in to leave an answer
Blogs
Caching in PHP: Redis, Memcached, and Built-in Solutions for Site Acceleration
Dependency Injection in Java: A Complete Guide for Beginners
Reading a File Line by Line in C++: ifstream and 5 Fatal Mistakes
Default interface methods in Android: Nougat error and its solution (Kotlin)