Android - Build (Gradle) / Run the app

Card Puncher Data Processing

About

Gradle is the build system that packages up and compiles Android Apps. Android Studio automatically generates Gradle files for your application, including:

  • the build.gradle for your app and module
  • and the settings.gradle for your app.

You do not need to create these files.

Android Studio uses Gradle to compile and build your app. There is a build.gradle file for each module of your project, as well as a build.gradle file for the entire project.

Gradle

Build

You can run Gradle from the terminal but you can also use the run button which will automatically run the Gradle scripts in your project.

cd project/Path
./gradlew assembleDebug
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72311Library UP-TO-DATE
:app:prepareComAndroidSupportDesign2311Library UP-TO-DATE
:app:prepareComAndroidSupportRecyclerviewV72311Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42311Library UP-TO-DATE
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources UP-TO-DATE
:app:processDebugManifest UP-TO-DATE
:app:processDebugResources UP-TO-DATE
:app:generateDebugSources UP-TO-DATE
:app:compileDebugJavaWithJavac UP-TO-DATE
:app:compileDebugNdk UP-TO-DATE
:app:compileDebugSources UP-TO-DATE
:app:transformClassesWithDexForDebug UP-TO-DATE
:app:mergeDebugJniLibFolders UP-TO-DATE
:app:transformNative_libsWithMergeJniLibsForDebug UP-TO-DATE
:app:processDebugJavaRes UP-TO-DATE
:app:transformResourcesWithMergeJavaResForDebug UP-TO-DATE
:app:validateDebugSigning
:app:packageDebug UP-TO-DATE
:app:zipalignDebug UP-TO-DATE
:app:assembleDebug UP-TO-DATE

BUILD SUCCESSFUL

Total time: 2 mins 9.708 secs

Apk

The build will output an APK in the following directory:

app\build\outputs\apk

Installation

with adb

adb install -r app/build/outputs/apk/app-debug-unaligned.apk
2101 KB/s (1411332 bytes in 0.655s)
        pkg: /data/local/tmp/app-debug-unaligned.apk
Success

Main activity start

Starting the main activity

adb shell am start -n com.example.nicolasgerard.sunshine/com.example.nicolasgerard.sunshine.MainActivity
Starting: Intent { cmp=com.example.nicolasgerard.sunshine/.MainActivity }

Version

tools/revisions/build-tools.html

Support

Sync Project with Gradle Files

If your project is having Gradle issues, sometimes clicking the Sync Project with Gradle Files button helps.

Android Sync Project With Gradle

Documentation / Reference





Discover More
Card Puncher Data Processing
Android - APK (Application package)

In build.gradle, applicationId is the fully qualified package name for your application that you specified during the New Project workflow. All APKs (.apk files) must be topics/security/permissionssigned...
Card Puncher Data Processing
Android - SDK ( API Level)

SDKs match API level. When a new API level is released, a new SDK is released to make projects for that level build.gradle compiledSdkVersion is the platform version against which you will compile...



Share this page:
Follow us:
Task Runner