I understand as Gradle is build tool and android provide plugin for android build.
When Gradle meet "apply plugin : 'android'" gradle-0.13.3.jar will be downloaded somewhere. right??
But I can not find android plugin anywhere.
How does Gradle build android using plugin ??
apply plugin: "xyz" applies a plugin that's already on the build class path. To get a third-party plugin such as the Android plugin on the build class path, a plugin dependency has to be specified in a buildscript block. For details on this, check the Gradle User Guide or the Android Gradle plugin docs.
(Gradle 2.1 introduces a new plugins block that allows to apply plugins available from http://plugins.gradle.org/ without specifying a plugin dependency.)
Related
In my React Native app, I got an error about incompatibilities with gradle 6, so I looked in my project structure to find out which version of gradle I was running in my project. I found this line in gradle-wrapper.properties
distributionUrl=https\://services.gradle.org/distributions/gradle-5.5-all.zip
and this line in build.gradle
classpath("com.android.tools.build:gradle:3.4.2")
What I Want To Know: What's the difference between the reference to gradle in each of these files? In other words, how is version 5.5 being used in my project, and how is 3.4.2 being used?
distributionUrl represents Gradel Version where as classpath represents Android Gradle plugin version.
Gradel vs Android Gradle plugin: Reffer this difference between android gradle plugin and gradle
Gradle is the build system.
You can use it with a lot of plugins. One of these is the plugin for Android.
It is used to provide processes and configurable settings that are specific to building and testing Android applications.
For greater details and mapping of the above two type of versions refer the following URLs
https://developer.android.com/studio/releases/gradle-plugin#updating-gradle
https://developer.android.com/studio/releases/gradle-plugin#updating-plugin
I hope this answer has cleared your doubts.
I just upgrade Android studio to the last version (3.2.1) and an issue occurred while charging my project. The Kotlin Gradle plugin seems to be incompatible with the current Android Gradle plugin version, or something like that.
Here's the message displayed:
The Android Gradle plugin supports only Kotlin Gradle plugin version 1.2.51 and higher. Project 'Projetpelican' is using version 1.2.41.
I can't find any satisfying answer on the web so please enlight me with your knowledge.
PS. A similar topic had already been created but it does not fully answer the question...
in your build gradle
change 1.2.41 to following
buildscript {
ext {
kotlin_version = '1.3.10'
I hope this help you
Update your Kotlin version.
Under your project-level build.gradle (the one outside of the app folder), find the ext.kotlin_version variable and set it to '1.3.11'.
When maintaining an Android project, you need to keep an eye out for yellow-highlighted dependencies. Android Studio doesn't update them for you.
Recently I have had to update my project to use Gradle 4.4 from 4.1.
i.e.
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
in my gradle-wrapper.properties file.
However, this is incompabitble with the fabric plugin
apply plugin: 'io.fabric'
As since the gradle update, I now get build errors when syncing my project.
Such as:
Error:Could not get unknown property 'manifestFile' for task
':Module:generateVariantFlavorRFile' of type
com.android.build.gradle.internal.res.GenerateLibraryRFileTask.
Does anyone know when/if there will be a new plugin update that is compatible with gradle 4.4+?
So my project included feature modules, where in the the base module's build.gradle, I apply the fabric plugin. i.e. apply plugin: 'io.fabric'
It turns out that gradle version 4.4 + does work but you need to add the following:
crashlytics { instantAppSupport true }
in your base module's build.gradle. I didn't actually have an instant app, but even with feature modules in appears that this line is needed.
More info on how this can be added can be found here:
How do I integrate Crashlytics with Android Instant Apps?
I am trying to run a project and it shows me:
Error running app: This version of Android Studio is incompatible with
the Gradle Plugin used. Try disabling Instant Run (or updating either
the IDE or the Gradle plugin to the latest version)
What should I do?
How can I update gradle?
The gradle plugin is declared inside the build.gradle file in your modules or in your root folder (top-level file).
Use:
classpath 'com.android.tools.build:gradle:2.0.0'
Also this requires gradle 2.10 (don't confuse the gradle plugin with gradle).
The gradle version is defined in gradle/wrapper/gradle-wrapper.properties.
Use:
distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
For automatic update, you may set the version in Android Studio > File > Project Structure > Project > Android Plugin Version
Please note that you might also need to update Gradle Version. For gradle and gradle plugin compatibility, you may refer to the docs.
Sync gradle afterwards. This will automatically set the distribution URL as well.
I was just wondering why that line of code exists in my gradle configuration
Android gradle apply plugin: 'com.android.application'
Gradle is a general-purpose build system. It uses plugins to teach it how to build different types of software. com.android.application is a Gradle plugin that teaches Gradle how to build Android applications, just as com.android.library is a plugin that teaches Gradle how to build Android library projects. There are many plugins available for Gradle, to teach it how to build other sorts of systems or augment other plugins.
As describe in the official website:The first line in the build configuration applies the Android plugin for
Gradle to this build and makes the android block available to specify
Android-specific build options.