Skip to content

Fix OOM during build and add Compose previews to all screens#2

Draft
Copilot wants to merge 2 commits into
copilot/create-android-clicker-gamefrom
copilot/fix-java-heap-error
Draft

Fix OOM during build and add Compose previews to all screens#2
Copilot wants to merge 2 commits into
copilot/create-android-clicker-gamefrom
copilot/fix-java-heap-error

Conversation

Copilot AI commented Feb 28, 2026

Copy link
Copy Markdown

Gradle build fails with java.lang.OutOfMemoryError: Java heap space due to missing JVM heap config. All screens also lack @Preview annotations, requiring a full project build to inspect UI.

OOM fix

Added JVM heap args to gradle.properties:

org.gradle.jvmargs=-Xmx2048m -XX:MaxMetaspaceSize=512m -Dfile.encoding=UTF-8

Compose previews

  • Added debugImplementation("androidx.compose.ui:ui-tooling") to build.gradle.kts
  • Refactored all 11 screens to extract a stateless *Content composable that takes data/callbacks instead of NavController/GameViewModel, enabling @Preview without runtime dependencies
  • The original *Screen composable remains as a thin wrapper; no navigation or game logic changed
// Before: only Screen composable, not previewable
@Composable
fun GameScreen(navController: NavController, viewModel: GameViewModel) { ... }

// After: Content composable is pure and previewable
@Composable
fun GameScreenContent(state: GameState, onAddClick: () -> Unit, ...) { ... }

@Preview(showBackground = true, showSystemUi = true)
@Composable
private fun GameScreenPreview() {
    PlagueTheme {
        GameScreenContent(state = GameState(...), onAddClick = {}, ...)
    }
}

Screens covered: HomeScreen, GameScreen, ShopScreen, PauseScreen, ResumeScreen, NewGameScreen, AboutScreen, GlobalStatsScreen, CurrentStatsScreen, VictoryScreen, DefeatScreen.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • dl.google.com
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.xml/javax.xml.namespace=ALL-UNNAMED --add-opens=java.base/java.time=ALL-UNNAMED -XX:MaxMetaspaceSize=512m -Xmx2048m -Dfile.encoding=UTF-8 -Duser.country -Duser.language=en (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Co-authored-by: pitatir <112723049+pitatir@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix Java heap space error and improve screen preview Fix OOM during build and add Compose previews to all screens Feb 28, 2026
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

Successfully merging this pull request may close these issues.

2 participants