Troubleshooting
Common issues and fixes when working through this guide.
Gradle & build
- “Cannot resolve external dependency … because no repositories are defined”
- A Gradle build needs
mavenCentral()(andgoogle()for Android) declared insettings.gradle.ktsunderdependencyResolutionManagement { repositories { } }. - “Unsupported class file major version” / Java version errors
- Use JDK 17. Check
java -version, and set the Gradle JDK in your IDE’s settings. - Gradle wrapper fails to download the distribution
- Check network/proxy. The version is pinned in
gradle/wrapper/gradle-wrapper.properties. - Kotlin/Compose compiler version mismatch
- With Kotlin 2.0+, apply the
org.jetbrains.kotlin.plugin.composeplugin (it matches the Kotlin version). Do not set a manualkotlinCompilerExtensionVersion.
Android Studio
- Gradle sync fails after creating a project
- Update Android Studio and the AGP version, then File → Invalidate Caches / Restart.
- Emulator won’t start
- Enable hardware acceleration (VT-x/AMD-V) in BIOS; create a fresh AVD in Device Manager.
@Composablefunction call errors- Composables can only be called from other composables or from
setContent.
Coroutines
Module with the Main dispatcher is missingin unit tests- Call
Dispatchers.setMain(StandardTestDispatcher())before andDispatchers.resetMain()after, and userunTest. Addkotlinx-coroutines-test. - A coroutine never finishes / test hangs
- You may be blocking instead of suspending, or not advancing virtual time. Use
advanceUntilIdle()insiderunTest.
GitHub Pages
- Site builds locally but links break on Pages
- Set
baseurlin_config.ymlto your repo name, and use{% link path %}for internal links rather than hard-coded URLs. - Pages shows a 404 after enabling
- Pages can take a minute on first deploy. Confirm the Pages source is set to GitHub Actions and the workflow succeeded.
Jekyll (local preview)
bundle: command not found- Install Ruby and Bundler, then run
bundle installindocs/. - A page renders code literally / Liquid errors
- Jekyll’s Liquid runs before Markdown, so it interprets Liquid-style tag
delimiters even inside code spans. If a sample contains such delimiters, wrap
that sample in a Liquid
raw/endrawblock so it is rendered verbatim.