I'm following Android Basic Course and the solution code provided has enableEdgeToEdge() function call in onCreate() in MainActivity. When I use this line of code, I get Unresolved reference: enableEdgeToEdge error.
Couldn't find a solution to it despite trying multiple imports and looking on the Internet for the issue. Any ideas on how to fix this?
Code available on GitHub: https://github.com/alghe-global/Kotlin/blob/4a25e707d4efc3edf09c7f637635adec8f6e876b/AndroidBasicsCourse/TipTime/app/src/main/java/com/example/tiptime/MainActivity.kt#L36
N.B. Solution code from Google is available @ https://github.com/google-developer-training/basic-android-kotlin-compose-training-tip-calculator/blob/29dddab0d5d911f1607bc5602249f89012f4d45e/app/src/main/java/com/example/tiptime/MainActivity.kt#L54
Trying to import androidx.activity.enableEdgeToEdge and call enableEdgeToEdge() in onCreate(...) gives the error Unresolved reference: enableEdgeToEdge on both the import enableEdgeToEdge and the function call enableEdgeToEdge()
The Jetpack Compose team has introduced the enableEdgeToEdge() to avoid boilerplate code related to system bars like the status bar, navigation bar, etc.
You need to update to the latest version of implementation('androidx.activity:activity:1.8.1') to use enableEdgeToEdge features.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With