Files
Helldivers-app-movil/.claude/agent-memory/java21-android-legacy-builder/gradle_build_config.md
2026-04-14 22:59:04 +02:00

2.2 KiB

name, description, type
name description type
Gradle Build Configuration Gradle build files for Java 21 + API 18 with desugaring support reference

Gradle Build Configuration

Migrated from Maven to Gradle due to SDK compatibility issues.

Key Files

settings.gradle

pluginManagement {
    repositories {
        google()
        mavenCentral()
        maven { url 'https://repo.maven.apache.org/maven2' }
    }
}

dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        google()
        mavenCentral()
        maven { url 'https://repo.maven.apache.org/maven2' }
    }
}

rootProject.name = "Helldivers2App"
include ':app'

build.gradle (Root)

buildscript {
    repositories {
        google()
        mavenCentral()
        maven { url 'https://repo.maven.apache.org/maven2' }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:8.2.0'
    }
}

plugins {
    id 'com.android.application' version '8.2.0' apply false
}

app/build.gradle

android {
    namespace 'com.helldivers.app'
    compileSdk 28

    defaultConfig {
        applicationId "com.helldivers.app"
        minSdk 18
        targetSdk 21
        versionCode 1
        versionName "1.0"
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_21
        targetCompatibility JavaVersion.VERSION_21
        coreLibraryDesugaringEnabled true
    }

    java {
        toolchain {
            languageVersion = JavaLanguageVersion.of(21)
        }
    }
}

dependencies {
    implementation 'com.google.android:android:4.1.1.4'
    implementation 'com.google.zxing:core:3.5.2'
    implementation 'com.google.zxing:android-core:3.3.0'
    coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.0.4'
}

Compile Commands

# Debug APK
.\gradlew clean assembleDebug

# Install to device
.\gradlew installDebug

# Output: app/build/outputs/apk/debug/app-debug.apk

Why: Maven had issues with Android SDK path resolution. Gradle wrapper provides more reliable builds across different environments.

How to apply: Use gradlew.bat for all builds. Set JAVA_HOME to JDK 21 before running.