I tried to reuse and existing code form github :
https://github.com/demantz/RFAnalyzer
I'm opening it with Android Studio and import the project (as it's said on the git page). I'm eperiencing some troubles with gradle which I'm not familiar with.
At first Android Studio tells me that the gradle version used in the the project must be upgraded :
1.12 -> 1.3.
And then I have a message saying that "gradle dsl method not found 'jcenter()'"
Thanks in advance.
JCenter (jcenter()) was introduced by Gradle 1.7.
See Gradle 1.7 JCenter repository support.
Make sure to upgrade your Gradle to at least 1.7.
See "how to check the gradle version in my Android Studio?"
File->Project Structure->Project pane->"Android plugin version".
Make sure you don't confuse the Gradle version with the Android plugin version.
The former is the build system itself, the latter is the plugin to the build system that knows how to build Android projects
Related
I'd like to use the latest version of Gradle in Android Studio. How do I check which version is used, and how do I upgrade to the latest one (if it is supported)? I would like to upgrade because I read that the latest version of Gradle improves build times.
You can check current Gradle version in Project Structure (File -> Project Structure...).
You can change default Gradle by using local distribution. However, I am not sure if Android Studio can support Gradle 2.4. Maybe you can have a try. Or you can change gradle-wrapper.properties directly.
I am trying to open a Android Project in Android Studio 1.0.2 which uses
classpath 'com.android.tools.build:gradle:0.12.+'
as its dependency. On opening the project with above dependency I get the following error message.
The project is using an unsupported version of the Android Gradle plug-in (0.12.2). The recommended version is 1.0.0.
Is there a way to run such projects in Android Studio 1.0.+ without upgrading the Gradle plug-in version
Note:
I can upgrade the gradle version and plugin to get it to work OR simply use older version of Android Studio to open the project.
First approach is not desirable since this being a community project I will prefer to leave majority of files unchanged and changing gradle version will also hinder me from testing the build with 0.12.
To successfully build Android project using Android Studion and Gradle you need to use the AS, Gradle and Android Gradle Plugin with versions which are compatible with each other. Check out this page, it's said here, that you can use Android Gradle Plugin 0.12 with Android Studio 0.8.0 - 0.8.11 and there is no way to use it under Android Studio 1.0.
I suggest you convince other people to switch to the newest version of Android Gradle Plugin because 1.0.0 is the stable one and doesn't contain some bugs which were out there in the 0.12.+.
Need your help.I updated Android Studio to latest one and i am getting this message in issue log.
Error:The project is using an unsupported version of the Android Gradle plug-in (0.8.3).
Starting with version 0.9.0 incompatible changes were introduced in the build language.
Please read the migration guide to learn how to update your project.
Open migration guide, fix plug-in version and re-import project
Please Let me know What should i do.
Regards
I'm new to gradle and got 2 questions:
gradle itself is a build tool, so why is the need for Android gradle tool com.android.tools.build:gradle:0.7.+ in the script?
What is the relation between the version of gradle installed (say 1.9) and the version of that Android gradle tool, like 0.7.+ in classpath 'com.android.tools.build:gradle:0.7.+'. If I changed the latter's version to 0.8.+ then the build fails on 'could not find plugin AppPlugin'.
1) Gradle is a build tool, but it requires specific plugin to work.
Android Tool Team is releasing the Android plugin for Gradle.
com.android.tools.build:gradle:0.6.+
com.android.tools.build:gradle:0.7.+
com.android.tools.build:gradle:0.8.+
Here you can find the repo:
https://android.googlesource.com/platform/tools/base/
The current dev branch is idea133. Otherwise you can check gradle_0.8/gradle_0.7 branches.
2) There is a relation between gradle-plugin and the gradle version.
For example
com.android.tools.build:gradle:0.6.+ -> gradle 1.8
com.android.tools.build:gradle:0.7.+ -> gradle 1.9
com.android.tools.build:gradle:0.8.+ -> gradle 1.9/1.10
You can find gradle version used in your project in the file gradle/wrapper/gradle-wrapper.properties
Also there is a relation between gradle-plugin and the IDE version.
For example:
Android Studio 0.3.x -> gradle-plugin 0.6
Android Studio 0.4.x -> gradle-plugin 0.7
Android Studio 0.4.3+ -> gradle-plugin 0.8
For updated news you can check this link: http://tools.android.com/recent
You can also check this updated post:
Android Studio Gradle issue upgrading to version 0.5.0 - Gradle Migrating From 0.8 to 0.9 - Also Android Studio upgrade to 0.8.1
If you change your plugin version, check compatibility, and then click sync project with your gradle files.It will download a new plugin version if you need it.
I will try to answer your questions.
As you said, Gradle is a build tool, but the line you have mentioned in your first question is referring to Gradle Java plugin version. Gradle has plugin for building Java projects. These plugins extend upon the general purpose build tool Gradle is, and may provide additional features. You can read more about the Gradle plugins here.
The reason your build fails when you change the plugin version is simple, the plugin version 0.8 is not there. There is a relationship between Gradle version and the plugin version and a developer has to maintain that. You can only use a plugin version which has been released and is compatible with the Gradle version. I hope the answer to first question answers this anyways.
Steps I took to download Android Studio: http://wiki.ros.org/sig/Rosjava/Android%20Studio/Download
So when I try to use the default gradle wrapper it tells me that I need to version 1.8. So I looked up how to fix this, and so I downloaded a gradle version 1.8. Whenever I use that, it tells me that I need version 1.6.
If it matters, I'm trying to use Android and ROS (so I'm trying to import android_apps programs into Android studio).
Any help?
In a recent update of Android Studio, the android plugin for gradle was updated, and now requires Gradle 1.8.
Android Studio projects use a Gradle wrapper - its contained in every project. This takes care of the gradle stuff for you normally - i.e. you don't need to have Gradle installed on your system.
But because of this update you need to tell the wrapper the correct gradle version to use (because when the wrapper was created, it's gradle version was set up to 1.6, the old min gradle version).
In your project directory, open gradle-wrapper.properties under gradle/wrapper/.
Change the distributionUrl to:
distributionUrl=http\://services.gradle.org/distributions/gradle-1.8-all.zip
Then in Android Studio, resync your gradle file, under the Tools -> Android -> Sync Project with gradle files.
Then rebuild your project (Build -> Rebuild Project).