Questions tagged [android-gradle-plugin]

The Android Gradle Plugin is Android's standard build system. It is used as backing-build-system by Android Studio.

This tag is for questions about the Android Gradle plugin. The Android Gradle plugin was introduced at Google IO in 2013 and replace the legacy ant-based build system.

Resources

12012 questions
1378
votes
27 answers

What is Gradle in Android Studio?

Gradle is a bit confusing to me, and also for any new Android developer. Can anyone explain what Gradle in Android Studio is and what its purpose is? Why is it included in Android Studio?
1056
votes
34 answers

Android Studio: Add jar as library?

I'm trying to use the new Android Studio but I can't seem to get it working correctly. I'm using the Gson library to serialize/deserialize JSON-objects. But the library somehow isn't included in the build. I had created a new project with just a…
Ozzie
  • 11,365
  • 3
  • 18
  • 24
622
votes
27 answers

Is it possible to use Java 8 for Android development?

Searching the web, it is not clear if Java 8 is supported for Android development or not. Before I download/setup Java 8, can some one point me at any "official" documentation that says Java 8 is or is not supported for Android development.
nPn
  • 14,430
  • 8
  • 28
  • 50
582
votes
11 answers

What is the difference between compileSdkVersion and targetSdkVersion?

I have looked at the documentation for building with Gradle, but I'm still not sure what the difference between compileSdkVersion and targetSdkVersion is. All it says is: The compileSdkVersion property specifies the compilation target. Well, what…
coder123
  • 7,767
  • 5
  • 13
  • 13
568
votes
4 answers

Invoke-customs are only supported starting with android 0 --min-api 26

before i'm use build version gradle 26 but after change buildtoolsversion to 27 like as this image error : error build gradle screenshot
iDea Brains
  • 5,828
  • 2
  • 6
  • 10
548
votes
31 answers

How to create a release signed apk file using Gradle?

I would like to have my Gradle build to create a release signed apk file using Gradle. I'm not sure if the code is correct or if I'm missing a parameter when doing gradle build? This is some of the code in my gradle file: android { ... …
Jan-Terje Sørensen
  • 13,628
  • 8
  • 34
  • 36
507
votes
56 answers

Automatically accept all SDK licences

Since gradle android plugins 2.2-alpha4: Gradle will attempt to download missing SDK packages that a project depends on Which is amazingly cool and was know to be a JakeWharton project. But, to download the SDK library you need to: accept the…
nsvir
  • 7,723
  • 10
  • 27
  • 45
499
votes
5 answers

Gradle DSL method not found: 'runProguard'

I get an error after updating from my last project. Not a problem in my code but I'm having trouble with build.gradle. How can I fix it? build.gradle code here: apply plugin: 'android' android { compileSdkVersion 21 buildToolsVersion…
abaci
  • 5,116
  • 2
  • 9
  • 11
448
votes
24 answers

How to manually include external aar package using new Gradle Android Build System

I've been experimenting with the new android build system and I've run into a small issue. I've compiled my own aar package of ActionBarSherlock which I've called 'actionbarsherlock.aar'. What I'm trying to do is actually use this aar to build my…
Miguel Lavigne
  • 18,143
  • 8
  • 52
  • 46
435
votes
10 answers

Is it possible to declare a variable in Gradle usable in Java?

Is it possible to declare a variable in Gradle usable in Java ? Basically I would like to declare some vars in the build.gradle and then getting it (obviously) at build time. Just like a pre-processor macros in C/C++... An example of declaration…
klefevre
  • 8,134
  • 7
  • 37
  • 68
370
votes
24 answers

HttpClient won't import in Android Studio

I have a simple class written in Android Studio: package com.mysite.myapp; import org.apache.http.client.HttpClient; public class Whatever { public void headBangingAgainstTheWallExample () { HttpClient client = new…
AndroidDev
  • 18,031
  • 39
  • 126
  • 220
339
votes
21 answers

API 'variant.getExternalNativeBuildTasks()' is obsolete and has been replaced with 'variant.getExternalNativeBuildProviders()

Using Android Studio 3.3 Canary 11 with the gradle plugin version 3.3.0-alpha11. It throws the following error when trying to sync gradle WARNING: API 'variant.getExternalNativeBuildTasks()' is obsolete and has been replaced with…
326
votes
20 answers

Android Gradle plugin 0.7.0: "duplicate files during packaging of APK"

Using Android Gradle plugin 0.7.0 with the following build.gradle: buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.7.0' } } apply plugin:…
David Lawson
  • 7,163
  • 4
  • 28
  • 36
315
votes
25 answers

Error:(1, 0) Plugin with id 'com.android.application' not found

This is my first attempt at Android Studio. I installed 0.8.0 and updated to 0.8.2. As soon as a project is created I get the error message: Error:(1, 0) Plugin with id 'com.android.application' not…
Bob Kusik
  • 3,159
  • 2
  • 9
  • 3
311
votes
12 answers

Configuration on demand is not supported by the current version of the Android Gradle plugin

After upgrading to Android Studio 3.1.2 I am getting the following error: Configuration on demand is not supported by the current version of the Android Gradle plugin since you are using Gradle version 4.6 or above. Suggestion: disable…
Dick Lucas
  • 10,721
  • 9
  • 44
  • 71
1
2 3
99 100