How update plugins in android studio? - android

I ran my android project after almost a week and I got this message:
Plugin is too old, please update to a more recent version, or set
ANDROID_DAILY_OVERRIDE environment variable to
"a8faa180fc282060c9b8ec88f9bdcc9072121284"
How do I update my Plugins? I am using android Studio 2.0. Here is my build.gradle project file
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.0.0-alpha1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}

Change com.android.tools.build:gradle:2.0.0-alpha1 to com.android.tools.build:gradle:2.0.0-alpha3 which is the latest version.

Open your IDE. Open a project. Then look for the following:
If you are using Windows you go to Help -> Check for updates
If you are using Mac, you go to Android Studio (next to the Mac symbol, in the top left) -> Check for updates
Alternatively when you launch your SDK Manger, it automatically searches for updates to your plugins. Navigate to SDK Tools.

UDPATE (may-2016)
update to lastest
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
}
You can specify the Gradle version in either the File > Project Structure > Project menu in Android Studio, or by editing the Gradle distribution reference in the gradle/wrapper/gradle-wrapper.properties file
distributionUrl = https\://services.gradle.org/distributions/gradle-2.10-all.zip
check gradle revisions
The Android Gradle Plugin and Gradle
Android Gradle Plugin Requires Gradle
1.0.0 - 1.1.3 2.2.1 - 2.3
1.2.0 - 1.3.1 2.2.1 - 2.9
1.5.0 2.2.1+
2.* 2.10+
check answer for update gradle

Change the line
classpath 'com.android.tools.build:gradle:2.0.0-alpha1'
to a latest version like
classpath 'com.android.tools.build:gradle:2.0.0-alpha3
(latest version at the moment of answering)

Related

Error:(1, 0) Plugin is too old, please update to a more recent version, or set ANDROID_DAILY_OVERRIDE "e71316b1598b09073ff04c4315280c3b0e755860"

I am using Android studio version 2.2 Preview 4. I am getting below error when ever open my IDE.
Error:(1, 0) Plugin is too old, please update to a more recent version, or set ANDROID_DAILY_OVERRIDE environment variable to "e71316b1598b09073ff04c4315280c3b0e755860"
Gradle:
options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.0-alpha4'
here; they belong
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
You're getting that error because you're using a version of Android Studio that is nearly 2 years out of date. Android Studio 2.2 stable was released on 19th September 2016 according to this page.
As there is no direct upgrade path from 2.x to 3.x using Android Studio's update manager, I would advise downloading the latest version of Android Studio (3.1.2 at the time of writing) and importing your existing project.
First, you have to update your Android Studio so go to:
Help -> Check for Updates...
in Mac: Android Studio > Check for Updates
And also you have to update your build tools to the latest version like below:
classpath 'com.android.tools.build:gradle:3.1.3'

LibGdx doesn't working after updating Gradle (Android Studio 3.0)

I have recently updated android studio and gradle to the version 3.0.0 following instructions in this link https://developer.android.com/studio/build/gradle-plugin-3-0-0-migration.html
After doing this libgdx desktop project doesn't work.
It give me this error
java.lang.NoClassDefFoundError: com/badlogic/gdx/ApplicationListener
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
at java.lang.Class.getMethod0(Class.java:3018)
at java.lang.Class.getMethod(Class.java:1784)
at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526)
Caused by: java.lang.ClassNotFoundException: com.badlogic.gdx.ApplicationListener
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 7 more
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main"
Here is build.gradle file
buildscript {
repositories {
mavenLocal()
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
}
I only added google() to repositories and edit gradle version to 3.0.0
In gradle-wrapper.properties I added this line
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
Android Studio 3.0 using gradle-4.1 and com.android.tools.build:gradle:3.0.0
Gradle 4.1 is not supported yet in LibGDX, there is an issue for the same, which is now upgraded for Gradle 4.6
Currently html module using deprecated jetty plugin which is removed in Gradle 4.1 version.
However using Terminal you can run desktop module, I've not tested on windows but on Mac it's working fine.
./gradlew desktop:run
For now you can use lower version of Gradle and Andoid-gradle-plugin in Android Studio 3.0 and wait for issue to be fixed.
Downgrade Gradle version from 4.1 to 3.3
Find gradle folder inside your project, Open gradle-wrapper.properties and change distributionUrl for 3.3
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
Downgrade Android-gradle-plugin version from 3.0.0 to 2.3.3
Open root build.gradle file and find artifact in buildscript and
change version
classpath 'com.android.tools.build:gradle:2.3.3'
Comment/delete google() from repo list inside root build.gradle file
--------------------------------------------------------------------------------
EDIT : Update LibGDX project to Gradle 4.6 - AS USER
Upgrade Gradle to 4.6 :
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
Add Google's Maven repo in project repositories list as well as in buildScript repo list in root build.gradle file.
repositories {
//..
google()
jcenter() // Required for org.jetbrains.trove4j:trove4j library
}
Update Android Gradle Plugin :
classpath 'com.android.tools.build:gradle:3.1.3'
Known issues with the Android Gradle Plugin
Configuration on demand with Gradle 4.6 and above:
If you're using Android Gradle Plugin 3.0.x or 3.1.x with Gradle 4.6
and above, you should disable configuration on demand to avoid some
unpredictable build errors. (If you are using Android Gradle Plugin
3.2.0 or higher, you do not need to take any action to disable configuration on demand.)
Disable configuration on demand in your gradle.properties file as shown below:
org.gradle.configureondemand=false
To disable configuration on demand in the Android Studio settings, choose File > Settings (Android Studio > Preferences on Mac), select the Compiler category in the left pane, and clear the Configure on demand checkbox.
In Android Studio 3.2 Beta 1 and higher, the options for enabling configuration on demand have been removed.
Update Android buildToolsVersion to 27.0.3 and SdkVersion to 27
Remove instrumentTest.setRoot('tests') from sourceSets inside android build.gradle file
replace all compile with implementation inside root build.gradle file
New GWT Gradle Plugin added in html module, check latest build.gradle of html module.
Run your project with Run Configuration or On Terminal using gradle task.
If you're going to create new project use gdx-setup.jar of latest build.
I temporarily solve this by forcing plugin to use 2.3.3 and gradle wrapper properties file reverted to 3.3
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
and build.gradle
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
}
comment out the google() from repositories and tell android studio 3.0 to stop reminding you to upgrade gradle plugin to 3.0.0 for your current project.
Edit: To the person above who plagiarised my answer, shame on you!
Edit configurations -> Desktop -> In before launch change "Build" to "Build project". (use the + and - buttons).
worked with windows , in terminal you can go to the project folder and run desktop module using command .
gradlew desktop:run

Gradle build failing after update to 3.0

I've recently updated the gradle version of my project from 2.14.1 to 3.0. Since then the gradle build is failing every time with this error:
Error:Cause: org.gradle.api.internal.tasks.DefaultTaskInputs$TaskInputUnionFileCollection cannot be cast to org.gradle.api.internal.file.collections.DefaultConfigurableFileCollection
Possible causes for this unexpected error include:Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)
Re-download dependencies and sync project (requires network)The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem.
Stop Gradle build processes (requires restart)Your project may be using a third-party plugin which is not compatible with the other plugins in the project or the version of Gradle requested by the project.In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.
I've searched google and found some solutions like this one but nothing is working. Does anyone know how to fix it?
Upgrade your gradle build tools to the latest version.
One easy way to do this is to add the latest version of the build tools as a dependency in your build.gradle file, for example:
dependencies {
classpath 'com.android.tools.build:gradle:2.2.0-beta1'
}
You can then run gradle tasks and gradle will download everything you need.
After Android Studio 2.2 stable released on Sep 19 2016 , the latest version of the build tools is 2.2.0 . So you can fix it by :
dependencies {
classpath 'com.android.tools.build:gradle:2.2.0'
}
As Android Studio 2.4 stable is not ready to release yet (May 4 2017), the latest stable version of build tools is 2.3.1 .
dependencies {
classpath 'com.android.tools.build:gradle:2.3.1'
}
If you update this build tools version to 2.3.* , you should also update gradle wrapper version to 3.3 in /yourProjectRoot/gradle/wrapper/gradle-wrapper.properties file. (i know it is not matching question Gradle build failing after update to 3.0, but i strongly suggest you to use latest build tool as google recommended)
BTW: version 2.3.1 of build tool is only exist on jCenter, not MavenCentral, so if you run into error below when run gradlew command line in terminal
Could not find com.android.tools.build:gradle:2.3.1.
Searched in the following locations:
https://repo1.maven.org/maven2/com/android/tools/build/gradle/2.3.1/gradle-2.3.1.pom
https://repo1.maven.org/maven2/com/android/tools/build/gradle/2.3.1/gradle-2.3.1.jar
just replace mavenCentral() with jcenter() like
repositories {
jcenter()
//mavenCentral()
}
For latest update of Android Studio 3.0
In gradle-wrapper.properties(File Name) change URL of distributionUrl to the following:
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
If you use gradle plugin 2.1.3,
It's simple to solve:
update your gradle plugin to version 2.2.0-beta1
Notes: this is a beta version, maybe you can get any other issues.
https://discuss.gradle.org/t/classcastexception-in-gradle-nightly-3-0-20160609/17979
Happy coding :)
Okay I got it working. For anyone facing the same problem the way it worked for me is as follows:
Go to your external .gradle folder (for me it was C:\Users\drilon.gradle). Inside caches and daemon folder delete all the version folder (they look like this "2.14.1", or "3.0"). Also go to wrapper -> dists -> delete everything there.
Inside your project root (for me it was C:\Users\drilon\AndroidStudioProjects\PorjectName) go to the .gradle folder and delete everything there.
Rebuild the project
EDIT:
Turns out this solution was setting the gradle version back to 2.14.1. ending0421's solution is the working one.
For latest update of Android Studio 3.3.1 below code work.
1) gradle-wrapper.properties add below line.
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
2)build.gradle in project level add below classpath
dependencies
{
classpath 'com.android.tools.build:gradle:3.1.0'
}
if your gradle version is: 3.0.1 then use below code in your gradle-wrapper.properties distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
if 3.1.2 then use below code in your gradle-wrapper.properties
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
After 1 hour R&D No Solution as worked for me...
But still i have solution follow this its work 100%
step 1: upgrade your build.gradle(Project:<your project name>)
Example : classpath 'com.android.tools.build:gradle:2.1.3' // old gradle file
classpath 'com.android.tools.build:gradle:2.3.1' // upgraded file
OR
classpath 'com.android.tools.build:gradle:3.1.0'
Step 2 : Upgrade compileSdkVersion buildToolsVersion
Example : compileSdkVersion 23 buildToolsVersion "23.0.3 // old api's
compileSdkVersion 25 buildToolsVersion "25.0.2" // upgraded api's
Step 3: upgrade gradle-wrapper.properties
Example : distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip // old or any version
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip // new or any version
Step 4 : finally goto build>rebuild project...
Still You face some problem commit or inbox me....
......End #Ambilpura
You should check your Gradle Plugin version and Gradle version before updating.
Check Gradle Plugin Version in your project level build.gradle file-
buildscript {
repositories {
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:gradle.plugin.version'
}
}
Check Gradle Version in your gradle-wrapper.properties-
distributionUrl=https\://services.gradle.org/distributions/gradle-gradle.version.zip
At the time of this answer, below were the latest versions. You can match your versions on this page.
Simply delete everything inside gradle folder in main project folder and Rebuild the
project. It will start working.
If your gradle plugin 3.0.0 for studio version 3.0, Add this in gradle-wrapper.properties
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
simple answer try this...
goto build.gradle(PROJECT) and check the gradle version as shown below
'com.android.tools.build:gradle:2.1.3' or 3.0 or 3.1 or xx.xx
now open gradle-wrapper.properties see this line of code if gradle version is 2.x this the code below...
distributionUrl=https://services.gradle.org/distributions/gradle-2.14.1-all.zip
gradle-2.14.1-all.zip line of code must be same as gradle version
example:
example:
mine is 2.x so...
classpath 'com.android.tools.build:gradle:2.1.3' in build.gradle so
distributionUrl=https://services.gradle.org/distributions/gradle-2.14.1-all.zip
in gradle-wrapper.properties.
if gradle version is 3.x then
classpath 'com.android.tools.build:gradle:3.1.0' in build.gradle then
distributionUrl=https://services.gradle.org/distributions/gradle-3.14.1-all.zip
in gradle-wrapper.properties.
check this it will works
if Android Studio Android Studio 3.0 below code work.
gradle-wrapper.properties add below line.
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
if Android Studio Android Studio 3.1.2 below code work.
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
if Android Studio 3.3.1 below code work.
1) gradle-wrapper.properties add below line.
distributionUrl=https://services.gradle.org/distributions/gradle-4.6-all.zip
2) build.gradle in project level add below
dependencies {
classpath 'com.android.tools.build:gradle:3.1.0'
}
Android Gradle dependencies are not working in new update of Android
Studio
Most important thing if you are face a lot of problems :
It is applicable on plugin 7.1 or new update version
Please Try this:
Go To -> settings.gradle inside of repositories { } :
add two files as :
maven{ url("https://repo.gradle.org/gradle/libs-releases/") }
maven { url "https://jitpack.io" }
The complete structure in
settings.gradle
file as given below :
pluginManagement {
repositories {
gradlePluginPortal()
google()
mavenCentral()
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
maven{ url("https://repo.gradle.org/gradle/libs-releases/") }
maven { url "https://jitpack.io" }
}
}
rootProject.name = "MyApp"
include ':app'
And last step, it is must be added into gradle.properties files.
android.useAndroidX=true
android.enableJetifier=true

Gradle version 2.2 is required. Current version is 2.10

I am trying to use gradle build. It gives me error saying that
Failed to apply plugin [id 'com.android.library']
Gradle version 2.2 is required. Current version is 2.10. If using the gradle wrapper, try editing the distributionUrl in /home/sanjeewa/workspace/Android/UVCCamera/gradle/wrapper/gradle-wrapper.properties to gradle-2.2-all.zip
But my gradle-wrapper.properties includes gradle-2.4-all.zip. I have changed it to gradle-2.2-all.zip
Still same problem.
When I run gradle -version in terminal Gradle 2.10 shows as version.
How to solve that error??
my build gradle file is
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
}
}
allprojects {
repositories {
jcenter()
}
}
Open gradle-wrapper.properties
Change this line:
distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip
with
distributionUrl=https\://services.gradle.org/distributions/gradle-2.8-all.zip
Go to build.gradle (Project: your_app_name)
Change this line
classpath 'com.android.tools.build:gradle:XXX'
to this
classpath 'com.android.tools.build:gradle:2.0.0-alpha3'
or
classpath 'com.android.tools.build:gradle:1.5.0'
Don't click Sync Now
From menu choose File -> Invalidate Caches/Restart...
Choose first option: Invalidate and Restart
Android Studio would restart. After this, it should work normally
Hope it help
Current work around is to overrideVersionCheck: In your build.gradle
buildscript {
System.properties['com.android.build.gradle.overrideVersionCheck'] = 'true'
...
}
Check this link for more Details
Just Change in build.gradle file
classpath 'com.android.tools.build:gradle:1.3.0'
To
classpath 'com.android.tools.build:gradle:2.0.0'
Now GoTo -> menu choose File -> Invalidate Caches/Restart...
Choose first option: Invalidate and Restart
Android Studio would restart.
After this, it should work normally.
Based on
https://developer.android.com/studio/releases/gradle-plugin.html ...
The following table lists which version of Gradle is required for each version of the Android plugin for Gradle.
For the best performance, you should use the latest possible version of both Gradle and the Android plugin.
So, the Plugin version with Required Gradle version should be match.
Here's what I did to fix this:
1) Create a new project
2) open the gradle-wrapper.properties file and copy the distributionUrl to your project e.g.:
distributionUrl=https\://services.gradle.org/distributions/gradle-3.2-all.zip
3) open the build.gradle (Project) and copy the gradle dependency to your project e.g.:
classpath 'com.android.tools.build:gradle:2.3.0-beta1'
4) File --> Invalidate Caches / Restart (I think a re-sync may have sufficed, but didn't try it)
5) Delete that project you made (optional)
Look, this is a silly way to do things, but Android Studio is free so who am I to complain...
Use ./gradlew instead of gradle to resolve this issue.
The android studio and Gradle version looks like very bad managed. And there's tons of version in-capability issues. And the error message is mostly clueless. For this particular issue. The closest answer is from "Jitendra Singh". Change the version to:
classpath 'com.android.tools.build:gradle:2.0.0'
But in my case: Android studio 2.2 RC, I still get another error:
Could not find matching constructor for: com.android.build.gradle.internal.LibraryTaskManager(org.gradle.api.internal.project.DefaultProject_Decorated, com.android.builder.core.AndroidBuilder, android.databinding.tool.DataBindingBuilder, com.android.build.gradle.LibraryExtension_Decorated, com.android.build.gradle.internal.SdkHandler, com.android.build.gradle.internal.DependencyManager, org.gradle.tooling.provider.model.internal.DefaultToolingModelBuilderRegistry)
So I went to the maven central to find the latest com.android.tools.build:gradle version which is 2.1.3 for now. So after change to
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.3'
}
}
Solved my problem eventually.
I Had similar issue. Every project has his own gradle folder, check if in your project root there's another gradle folder:
/my_projects_root_folder/project/gradle
/my_projects_root_folder/gradle
If so, in every folder you'll find /gradle/wrapper/gradle-wrapper.properties.
Check if in /my_projects_root_folder/gradle/gradle-wrapper.properties gradle version at least match /my_projects_root_folder/ project/ gradle/ gradle-wrapper.properties gradle version
Or just delete/rename your /my_projects_root_folder/gradle and restart android studio and let Gradle sync work and download required gradle.

Android Studio unsupported version of gradle but I'm using a compatible version

I'm on Ubuntu 14.04 and I'm using version 0.5.2 of Android Studio. I'm trying to import this project to my Android Studio GCM SAMPLE
But I get this error:
It says that I should use the version 1.10 of Gradle.
However, I am Indeed using that version.
What is happening here?
It's giving you the wrong error message. The actual problem is that the project is using the wrong version of the Android Gradle plugin -- this project specifies 0.7, but Android Studio 0.5.2 needs 0.9.
In the project's top-level build.gradle, in this block:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.7.+'
}
}
change the classpath line to:
classpath 'com.android.tools.build:gradle:0.9.+'

Categories

Resources