# Android Application Sample

version 6.4

- 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.

build.gradle

    // Top-level build file where you can add configuration options common to all sub-projects/modules.

    buildscript {
        repositories {
            google()
            jcenter()

        }
        dependencies {
            classpath 'com.android.tools.build:gradle:3.5.0'

            // NOTE: Do not place your application dependencies here; they belong
            // in the individual module build.gradle files
        }
    }

    allprojects {
        repositories {
            google()
            jcenter()

        }
    }

    task clean(type: Delete) {
        delete rootProject.buildDir
    }

build.gradle.kts

    // Top-level build file where you can add configuration options common to all sub-projects/modules.

    buildscript {
        repositories {
            google()
            jcenter()

        }
        dependencies {
            classpath("com.android.tools.build:gradle:3.5.0")

            // NOTE: Do not place your application dependencies here; they belong
            // in the individual module build.gradle files
        }
    }

    allprojects {
        repositories {
            google()
            jcenter()

        }
    }

    tasks.register("clean", Delete::class) {
        delete(rootProject.buildDir)
    }

To build the application:

    $ ./gradlew build

    > Task :app:lint
    Calling mockable JAR artifact transform to create file: /home/user/.gradle/caches/transforms-2/files-2.1/00fe5f39bae298f5f8203731bd0560d9/android.jar with input /opt/android/sdk/platforms/android-28/android.jar
    Ran lint on variant debug: 5 issues found
    Ran lint on variant release: 5 issues found
    Wrote HTML report to file:///home/user/app/build/reports/lint-results.html
    Wrote XML report to file:///home/user/app/build/reports/lint-results.xml

    Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
    Use '--warning-mode all' to show the individual deprecation warnings.
    See https://docs.gradle.org/5.6.2/userguide/command_line_interface.html#sec:command_line_warnings

    BUILD SUCCESSFUL
    55 actionable tasks: 55 executed

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.