I am following this tutorial in Android Studio.
When trying to Import the project, I get a dialog saying:
"The project is using an unsupported version of Gradle."
Please point to a supported Gradle version in the project's Gradle settings or in the project's Gradle wrapper (if applicable.)"
It also fails if I select the wrapper method by stating:
"Plugin with id 'com.android.application' not found.
Here is what Parse's gradle looks like:
apply plugin: 'com.android.application'
repositories {
mavenCentral() }
dependencies {
compile 'com.parse.bolts:bolts-android:1.1.3'
compile fileTree(dir: 'libs', include: 'Parse-*.jar') }
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
defaultConfig {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
res.srcDirs = ['res']
}
}
}
My project's Gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.1"
defaultConfig {
applicationId "id.goes.here"
minSdkVersion 19
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
} }
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
}
You generally have two build.gradles in your project:
A top level build.gradle in your project's root that contains buildscript {} and allprojects {} sections. This contains the project-wide configuration.
An app module build.gradle (located in your app's module folder) that contains the configuration for your android application. This one contains the android {} section.
Open up your top level build.gradle, and look at the Android Gradle plugin version (it will look something like classpath 'com.android.tools.build:gradle:1.0.0-rc3').
If the plugin is at version 0.13.0 or higher, you need to make sure you are using Gradle 2.1 or newer.
If the plugin is below version 0.14.4, you cannot use Gradle 2.2+.
Before going further, you need to find out whether you are using a local gradle distribution or the wrapper. To do so, go to File > Settings, then search for "Gradle." If "Use local Gradle distribution" is selected, either update your local Gradle to a supported version or switch to using the wrapper.
If you are using the wrapper, the configuration for the Gradle version is located under <your-project>/gradle/wrapper/gradle-wrapper.properties. This file contains a line that will look something like this: distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip
. Simply change the version at the end to a supported version.
Studio typically will offer to update the wrapper for you if you click on the error telling you that it is not a supported version.
I resolve this issue by syncing project with gradle files.
In android studio from menu open File option and click option sync project with gradle files.
In the project build,gradle file
Replace
runProguard false
With
minifyEnabled true
Related
Upgraded to:
Android Studio 3.0 Canary 2
com.android.tools.build:gradle:3.0.0-alpha2
I have a multi-module project (main app + sub modules)
Inclusion inside the main app:
dependencies {
implementation project(path: ':testlib', configuration: 'default')
}
The testlib is defined as a simple android library project and works normally when included with gradle 2.3.0 and via compile project(path: ':testlib')
I get the following gradle error message:
Could not resolve all dependencies for configuration ':app:devDebug_signedCompileClasspath'.
Selected configuration 'default' on 'project :testlib'
but it can't be used as a project dependency because
it isn't intended for consumption by other components.
What does "isn't intended for consumption by other components" mean in this context? The module is defined as an android library.
Here is the build.gradle of the testlib:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0-alpha2'
}
}
apply plugin: 'com.android.library'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
minSdkVersion 16
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
}
What am I missing?
I also got this error. Android Studio 3.0 Canary 4 just came out. I updated to it, which also updates gradle to 4.0rc1.
The problem went away on it's own.
alter your Top-level build file (aka root gradle)
classpath 'com.android.tools.build:gradle:3.0.0-alpha4'
still not working?
update dist-url (inside gradle-wrapper.properties)
distributionUrl=https\://services.gradle.org/distributions/gradle-4.0-rc-1-all.zip
I have setup android studio 2.2 and my sdk contains api 23 as well as api 24.
My build.gradle file is as below :
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "24.0.2"
defaultConfig {
applicationId "com.example.sanjay.myapplication"
minSdkVersion 15
targetSdkVersion 24
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha1'
testCompile 'junit:junit:4.12'
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2'
androidTestCompile 'com.android.support.test:runner:0.5'
androidTestCompile 'com.android.support:support-annotations:24.2.1'
}
I have getting below error :
Error:(1, 0) Plugin is too old, please update to a more recent version, or set ANDROID_DAILY_OVERRIDE environment variable to "9d813ee66dd60f65615706c5deaa14afed669ca5"
Fix plugin version and sync project</a><br>Open File
Please let me know, Whats going wrong here, Thank you.
When such error is shown (Plugin is too old, please update to a more recent version, Fix plugin version, and sync project), click on the Fix plugin version and sync project which appeared in the log cat. the Gradle will sync and you are good to go.
Update your Project level Build.gradle to
dependencies {
classpath 'com.android.tools.build:gradle:2.2.0'
}
Download the latest gradle from https://gradle.org/gradle-download/ and
Goto: Build, Execution, Deployment ->> Build Tools ->> Gradle (Or just type in the searchbar Gradle)
Select: (X) Use local gradle distribution and set Gradle home to your extracted Gradle directory. Click on apply.
Update your Project Build.gradle to
dependencies
{
classpath 'com.android.tools.build:gradle: "latest version here" '
}
see Grade Version Compatibility for Android Studio
I have a problem using jfeinstein10 Sliding Menu
I added the library into my root project folder. But I get this error :
Error:The SDK Build Tools revision (17.0.0) is too low for project
':SlidingMenu'. Minimum required is 19.1.0
But I'm already using "19.1.0" but it still says I'm using 17.0.0
Here is my build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "19.1.0"
defaultConfig {
applicationId "com.repliklernet.replikler"
minSdkVersion 14
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.1'
compile group:'com.squareup.picasso', name:'picasso', version:'2.5.0'
compile project(':SlidingMenu')
}
What am I missing ?
If you look at the build.gradle file for the library, you can see that it references build tools 17: https://github.com/jfeinstein10/SlidingMenu/blob/master/library/build.gradle#L17
You need to update that line.
The error is actually giving you a hint by mentioning project ':SlidingMenu', referring to the project SlidingMenu.
Right click on the project folder and choose 'Open Module Setings'
Select 'app' on the Modules List(Left pane)
Select 'Properties' tab and will present you with 'Compile SDK Version', 'Build Tools Version'.
Click OK
Reference : https://www.youtube.com/watch?v=v4b7C6Q-9dI
You should change the build.gradle within your library
I updated android studio from version 1.0 to 1.2.1 and when I started my first application the this appears.
Error:Execution failed for task ':app:compileDebugAidl'.
aidl is missing
I have made sure that all sdk are up to date. This is my gradle build code.
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "23.0.0 rc1"
defaultConfig {
applicationId "com.example.william.myapplication"
minSdkVersion 17
targetSdkVersion 22
versionCode 1
versionName "1.0"
compileSdkVersion 21
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
compile 'com.android.support:appcompat-v7:22.2.0'
}
It seems that AndroidStudio-1.3-Preview is using an unexpected version of the gradle plugin. (at least when you create a fresh new project)
Similarly, if you open an existing project using:
an older version of the plugin. (<1.3.0-beta1)
latest build tools (23.0.0-rc1)
compileSDK 22
---> you will probably have this strange error : "aidl is missing" (even in projects not using aidl !)
Solution:
Be sure to use the latest android-gradle-plugin (in the root build.gradle) :
classpath 'com.android.tools.build:gradle:1.3.0-beta1'
under buildscript-->dependencies.
Example :
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0-beta1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
and the latest build tools (in module build.gradle):
android {
compileSdkVersion 22
buildToolsVersion "23.0.0 rc1"
... }
BE AWARE that with this config you are using the latest build tools -not released yet- and the preview of Android-M ---> things can be unstable
I had the same error. I changed the build tools version in the gradle script to my actual sdk build tool version found in sdk manager and that did the trick.
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
...
I'm importing a project that may have been created in Eclipse to Android Studio. I'm not quite sure how to migrate to Gradle and the official docs aren't much of a help. The structure is as follows:
> app-android
> app
> swipelist_lib
> coollib_2
> another lib
> ...
The project has no build.gradle files so I added one in app-android and app. Then followed Studio to add a Gradle home. What exactly do I add in these files? Should I be adding the libraries manually by going through Project Structure > Dependencies or through the build.gradle file?
I'm currently getting Error:(1, 0) Plugin with id 'com.android.application' not found. and my project only has app folder showing (I'm assuming it should have the same structure as above)
My current app build.gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 19
buildToolsVersion "19.0.0"
defaultConfig {
minSdkVersion 8
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile project(":lib")
compile 'com.android.support:appcompat-v7:19.0.1'
compile fileTree(dir: 'libs', include: ['*.jar'])
}
The app-android build.grade file:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.1’
}
}
Change 2.2.1 to 1.1.0, which is the latest current version of the Gradle for Android plugin. 2.2.1 is the version of Gradle, which goes in gradle/wrapper/gradle-wrapper.properties, in the distributionUrl, if you have those.
Should I be adding the libraries manually by going through Project Structure > Dependencies or through the build.gradle file?
Either way works. Personally, I work with the build.gradle files directly.