# Building Android Apps Sample

version 7.6.6-20250802031809+0000

- Groovy DSL

- Kotlin DSL

| You can open this sample inside a Android Studio IDE using the project importer.

This sample shows how a simple Android application written in Java can be built with Gradle. The application was created following the Build your first app guide.

app/build.gradle

    plugins {
        id('com.android.application') version '7.1.1'
    }

    repositories {
        google()
        mavenCentral()
    }

    android {
        compileSdkVersion 30
        defaultConfig {
            applicationId 'org.gradle.samples'
            minSdkVersion 16
            targetSdkVersion 30
            versionCode 1
            versionName '1.0'
            testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
        }
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
            }
        }
    }

    dependencies {
        implementation 'androidx.appcompat:appcompat:1.2.0'
        implementation 'com.google.android.material:material:1.2.0'
        implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
        testImplementation 'junit:junit:4.13.1'
        androidTestImplementation 'androidx.test.ext:junit:1.1.2'
        androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
    }

app/build.gradle.kts

    plugins {
        id("com.android.application") version "7.1.1"
    }

    repositories {
        google()
        mavenCentral()
    }

    android {
        compileSdkVersion(30)
        defaultConfig {
            applicationId = "org.gradle.samples"
            minSdkVersion(16)
            targetSdkVersion(30)
            versionCode = 1
            versionName = "1.0"
            testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
        }
        buildTypes {
            getByName("release") {
                isMinifyEnabled = false
                proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
            }
        }
    }

    dependencies {
        implementation("androidx.appcompat:appcompat:1.2.0")
        implementation("com.google.android.material:material:1.2.0")
        implementation("androidx.constraintlayout:constraintlayout:2.0.4")
        testImplementation("junit:junit:4.13.1")
        androidTestImplementation("androidx.test.ext:junit:1.1.2")
        androidTestImplementation("androidx.test.espresso:espresso-core:3.3.0")
    }

To build the application:

    $ ./gradlew build

For more information, we suggest reading Getting Started with Gradle. You can also find Android development related information inside the guides provided by the Android team.