Here is the steps I took on my Mac Mini:
I run this homebrew in the terminal on Android Studio:
$ brew update && brew install gradle
I then ran this line in the same terminal: ./gradlew wrapper --gradle-version=4.0 --distribution-type=bin
Then I changed the distributionUrl in the gradle-wrapper.properties file to distributionUrl=https\://services.gradle.org/distributions/gradle-4.0-all.zip
I then changed the project's (top-level) build.gradle file's buildscript to:
buildscript {
repositories {
maven { url 'https://maven.google.com' }
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0-alpha1'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
classpath 'com.google.gms:google-services:3.0.0'
}
}
But I still get the error Error:This Gradle plugin requires Studio 3.0 minimum
Android Gradle Plugin is tied to corresponding version of Android Studio. Basically you can't use 3.x with Android Studio 2.3
Related
I have a problem in a react-native project after install react-native-vector-icons and try to build android app in the emulator. I'm working on Windows.
I installed the library and linked it as said in the manual, but I think I have a dependency problem.
C:\react-native run-android
Scanning folders for symlinks in C:\Users\user\Source\reactnative\myapp\node_modules (43ms)
Starting JS server...
Building and installing the app on the device (cd android && gradlew.bat installDebug)...
FAILURE: Build failed with an exception.
* Where:
Build file 'C:\Users\user\Source\reactnative\myapp\node_modules\react-native-vector-icons\android\build.gradle' line: 4
* What went wrong:
A problem occurred evaluating project ':react-native-vector-icons'.
> Could not find method google() for arguments [] on repository container.
Installed versions:
"react": "16.3.1",
"react-native": "0.55.4",
"react-native-elements": "^0.19.1",
"react-native-vector-icons": "^6.0.2",
Can somebody help me?
Your best option is to either downgrade the vector-icons version or upgrade react-native + react versions.
Another option is to manually update your gradle and gradle-wrapper versions in the android project.
So update the gradle version in the top-level gradle file:
Usually located here: project_name/android/build.gradle
Change to:
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
}
And also the gradle-wrapper:
Usually located here: project_name/android/gradle/wrapper/gradle-wrapper.properties
Change to:
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip
I had the same errors, the following steps worked for me:
1.change the code in android/build/gradle.
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenLocal()
jcenter()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
google()
}
}
In the above code, google() is added in buildscript and allprojects and
classpath gradle version is replaced by the gradle version of classpath in ..\node_modules\react-native-vector-icons\android\build.gradle (mine is 3.3.1, yours can be different).
in android/gradle/wrapper/gradle-wrapper.properties, modify the distributionUrl:
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip
Version of the above library is 4.10.1, The minimum version of the above library required by gradle version 3.3.1 is 4.10.1, so I installed gradle-4.10.1-all.zip in my project.
Uninstall vector-icons (remove wire-react-vector-icons-native)
Delete the folder node_modules
Then yarn install
Type this command yarn add react-native-vector-icons
Then this react-link native command react-native-vector-icons
Then this command reage-nactive run- android 7 then react-native start --reset-cache
These steps worked for me
i upgraded to android studio 3.0 from android studio 1.2
currently i cannot work on any of my old projects on android 3.0, been getting a lot of gradle build errors
example
Error:(1, 0) Minimum supported Gradle version is 3.3. Current version is 2.2.1.
Please fix the project's Gradle settings.
Fix Gradle wrapper and re-import projectGradle settings
Android Studio 3.0 using Gradle-4.1 and
Android-gradle-plugin 3.0.0
Find gradle folder inside your project
Open gradle-wrapper.properties and change
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
Open root build.gradle file and change in buildscript
classpath 'com.android.tools.build:gradle:3.0.0'
Additionally you need to add google() repo link in project repositories list and buildScript repo list.
repositories {
mavenLocal()
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
maven { url "https://oss.sonatype.org/content/repositories/releases/" }
jcenter()
google() //<- Add
}
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)
I've upgraded to Android Studio 0.8.1 and when I try to compile any app it fails with the following error:
Error:Artifact 'com.android.tools.build:gradle:0.12.1:gradle.jar' not found on Android Studio 0.8.1
I tried to update manually the plugin from gradle.org and it does not contain any gradle.jar binary.
How to resolve this error?
File -> Invalidate caches / Restart
Shutdown Android Studio
Rename/remove .gradle folder in the user home directory
Restart Android Studio let it download all the Gradle stuff it needs
Gradle build success !
Rebuild project.... success !
Try this:
./gradlew clean build --refresh-dependencies
It worked for me =)
Did you add this to the build.gradle file?
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.12.+'
}
}
It should download the file from the maven repository.
Go to your project directory and edit ./gradle/wrapper/gradle-wrapper.properties update the version number and then go to Tools -> Android -> Synch Project with Gradle Files.
Looks like gradle:0.12.1 is the problem, I just changed the "+" with "0" and it worked for me.
file: build.gradle from the root of project.
buildscript {
repositories {
mavenCentral()
}
dependencies {
//classpath 'com.android.tools.build:gradle:0.12.+'
classpath 'com.android.tools.build:gradle:0.12.0'
}
}
allprojects {
repositories {
mavenCentral()
}
}
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.+'