I tried setting the build tools version in the project settings to 25.0.0. And also to add the correct apply plugin statement (you'll find it in the screenshot). I've also tried syncing the project with Gradle files although I don't think this issue is related to that.
Basically making sure this is there. I also downloaded and updated the required SDKs. I'll attach the screenshots.
build.gradle file screenshot
https://i.stack.imgur.com/ardbH.png
Project Structure Settings > Module
https://i.stack.imgur.com/jRR09.png
SDK Info
https://i.stack.imgur.com/1n4jr.png
Build.gradle file (project level)
// 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.2.2'
classpath 'com.google.gms:google-services:3.0.0'
// 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
}
Dependencies
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.0.1'
compile 'com.google.firebase:firebase-database:9.0.2'
compile "com.google.firebase:firebase-auth:9.0.2"
compile 'com.firebase:firebase-client-android:2.3.1'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
For the Failed to Find Build Tools Revision 25.0.0 error in android studio first you save your work and close the project.
Open the SDK Manager and click on "SDK Tools"
Find the Package 25.0.0 and check if the package is installed or not.
Intsall the Package or else check if some other package with other version already installed and change the buildtooolversion in build.gradle
after performing this step run the program again it will work.
If the issue occurs again then try upgrading your buildtoolversion again.
You can please update your gradle plugin com.android.tools.build:gradle:2.2.2 in the project level file. This is an old one, maybe build tools 25.0.0 does not support it. Need to check in the release notes. I am pretty sure the latest is more than 3.4.0.
Related
After updating android studio 3.1.2 my existing project gives error at
dataBinding.enabled = true
error is as follows-
Failed to resolve: com.android.databinding:library:3.1.2
Failed to resolve: com.android.databinding:adapters:3.1.2
my gradle dependency are as follows-
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:25.1.0'
implementation 'com.android.support:recyclerview-v7:25.1.0'
implementation 'com.android.support:preference-v7:25.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.0-beta3'
implementation 'com.firebase:firebase-jobdispatcher:0.5.0'
// Instrumentation dependencies use androidTestCompile
// (as opposed to testCompile for local unit tests run in the JVM)
androidTestImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support:support-annotations:25.1.0'
androidTestImplementation 'com.android.support.test:runner:0.5'
androidTestImplementation 'com.android.support.test:rules:0.5'
}
I also tried
android.databinding.enableV2=true
but its also not working
When I tried to update build tool version to 4.4 then I found this error. I f I do not update the build tool version then its working fine.
check it this below code in your project level gradle file ..
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
According to the Android Team answer you had to add
google()
too all repositories
and priority is important. so other repositories must be added after google()
Downgrade to 3.1.0 in project level build.gradle file, then rebuild the project.
dependencies {
classpath 'com.android.tools.build:gradle:3.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
I hope this helps
I also has the same issue I ensured that I added google() to all repositories and also I downgraded gradle to 3.1.0 from 3.1.4 and my project was successfully build.
Another TIP: We can also add the below code to our build.gradle(project) which takes cares of libraries conflicts with new dependencies
configurations.all {
resolutionStrategy {
force"com.android.support:supportannotations:$androidSupportVersion"
force "com.android.support:support-v4:$androidSupportVersion"
force "com.android.support:appcompat-v7:$androidSupportVersion"
force "com.android.support:design:$androidSupportVersion"
force "com.android.support:recyclerview-v7:$androidSupportVersion"
}
}
And you can keep your libraries in a separate file such as libraries.gradle and include them in build.gradle(project)
buildscript
{
apply from: "./libraries.gradle"
}
I added Data-Binding to my project and the next time I build project, I faced the same issue, more specifically logcat displayed this message:
Failed to resolve: com.android.databinding:library:3.1.2
Failed to resolve: com.android.databinding:adapters:3.1.2
As per accepted answer, I checked my Project Level Gradle File to see whether it was missing google() in its repositories, but it was already there.
Build multiple times, but all in vain.
Then I did what my Android Master once told me to do, just in case when everything fails.
File -> Invalidate Caches/Restart.
Next time the project opened it build successfully.
I added the following line to my build.gradle(Module:app):
compile 'com.android.support:design:25.4.0'
But when executing Gradle I'm getting
Failed to resolve: com.android.support.design:25.4.0
I got that the support code from the android support design library and added it to a new project. I added it to the dependency section as such:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
compile 'com.android.support:design:25.4.0'
}
Any ideas on what I'm doing wrong?
Important: The support libraries are now available through Google's Maven repository. You do not need to download the support
repository from the SDK Manager. For more information, see Support
Library Setup.
Step 1: Open the build.gradle file for your application.
Step 2: Make sure that the repositories section includes a maven section with the "https://maven.google.com" endpoint. For example:
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
Step 3: Add the support library to the dependencies section. For example, to add the v4 core-utils library, add the following lines:
dependencies {
...
compile "com.android.support:support-core-utils:25.4.0"
}
A more updated version of the answer of "Bhavesh Patadiya" :
In your project build.gradle file, add google() into the repositories blocks:
repositories {
jcenter()
google()
}
Update the same file with a newer Gradle version:
classpath 'com.android.tools.build:gradle:2.3.3'
If the above cause you new issues or the same issue, exit Android-Studio, and delete the "gradle" folder/s (maybe also ".gradle" folder) and the "build" folder and sub-folders, and then open Android-Studio again.
Mr. Bhavesh Patadiya give us a good solution. However, I'd like to share something more, to make fix process more explicit.
There are two "build.gradle" files under the project directory. Their pathes are to be "Your-project-root-dir/build.gradle" and "Your-project-root-dir/app/build.gradle" respectively. When you see the error information in your android studio, and try to trace the file, you will probably open the second one.
You should add this statement in the first file ("Your-project-root-dir/build.gradle").
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
and add the statements in the second build.gradle ("Your-project-root-dir/app/build.gradle")
dependencies {
...
compile "com.android.support:support-core-utils:27.0.2"
}
Always keep appcompact version and support lib versionssame, so change com.android.support:design:25.4.0 to com.android.support:design:25.3.1
allprojects {
repositories {
google()
jcenter()
mavenCentral()
}
}
You need to update the android support Repository in the SDK manager . Also the Design Library depends on the Support v4 and AppCompat Support Libraries.
Same version android support must be the same with others..
compile 'com.android.support:appcompat-v7:25.3.1' <-- same
compile 'com.android.support:design:23.3.1' <-- same
after adding :
maven {
url "https://maven.google.com"
}
make sure your Gradle sync is on ONLINE mode
you can check it from:
Android studio -> Preferences -> Build, Execution, Deployment ->
Gradle -> Offline work (make sure this check box is not selected)
This problem occurs when there is andoridtestImplementation is added in app.build.
Remove testImplementation,androidTestImplementation from the app.build, that solves this issue.
Above answers did't resolve anything for me.
Tried syncing the project- Failed.
Tried building the project -Failed
Problem found :
Sdk Support Repository was corrupted
.
Fix:
Go to the SDK manager, click the "SDK Tools" tab. If the check-mark
for "Support Repository" is selected, unselect it and click OK. This
will delete all of the files in the repository. Then recheck the
check-mark, click GO and reinstall the repository.
If you still have the issue, check the project settings for offline mode. if offline mode is on, then off and sync the project. That fixed my issue.
There is no library by that name. There is com.android.support:recyclerview-v7:25.4.0.
Failed to resolve com.android.support:support-compat:25.4.0
Failed to resolve com.android.support:support-core-ui:25.4.0
I am trying to include this library to my project by adding
compile 'jp.wasabeef:recyclerview-animators:2.2.7'
so remove this line from gradle
my error just resolved
I have updated my Android studio, but after that, I cannot create a new project. My Android version is 2.2 beta 3.
This is an image of the error messages when attempting to create a Gradle sync project:
I was having the same problem, but I have fixed mine by removing this line of code from my Gradle module (app) level:
After removing to sync the project hopefully it will fix the problem.
Edit the dependencies in gradle app as:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:24.2.1'
}
This worked for me :)
1.go to settings
2.select gradle option.
3.uncheck "offline work".
4.rebuild project.
5.that's it. make sure you have a internet connection.
Try adding the dependencies repositories in Project build.gradle
allprojects {
repositories {
google()
jcenter()
"Your dependencies repositorie"
}
}
when I tried to connect my project to firebase using android studio 2.2 preview 3 automated tool it shows this error
Error:com.android.builder.internal.aapt.AaptException: Failed to crunch file %s into %s
this is build gradle for app
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:24.0.0-beta1'
compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha3'
compile 'com.google.firebase:firebase-auth:9.0.2'
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.0.0-beta1'
}
this is build.gradle for project
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.0-alpha3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.gms:google-services:3.0.0'
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Android Studio 2.2 preview 4 version fixed the issue.
http://tools.android.com/recent/androidstudio22preview4available
Try using Android Studio 2.1
I had the same problem. Then I started using Android Studio 2.1. Works for me now
This may happen when you change the project location
from - where you have created and coded the whole project
to - somewhere from where you are importing the project.
Can't use google maps because of above said error. Anyone find the same issue ?
Make sure that the following line is at the end of the app build.gradle file:
apply plugin: 'com.google.gms.google-services'
Mine was on the top and gradle was defaulting to 8.3.0 instead of what was specified: 8.4.0
My build.gradle files are the same as the ones in the Version conflict updating to 8.4.0
As those previous anweres are only part-wise complete.
Here are my three steps which worked fine for me:
Put this to the end of your apps build.gradle
apply plugin: 'com.google.gms.google-services'
Set your projects build.gradle dependencies to
'classpath 'com.google.gms:google-services:2.0.0-alpha5'
Set Gradle Version to 2.10
Android Studio: File > Project Structure > Project
#redsonic's answer worked for me.. By simply moving apply plugin:
'com.google.gms.google-services' after the dependecies in
build.gradle (Module: app)
I'm using Android Studio 1.5.1 with Gradle version 2.10
In case you are using Gradle version older than 2.10 you'll also need to update that by selecting the ProjectName or app directory in the Project tool Windows and pressing F4. This will open Project Structure window, select Project from the menu and update Gradle version to 2.10. Press OK (Android Studio will download it in background).
build.gradle (Project: ProjectName)
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
classpath 'com.google.gms:google-services:2.0.0-alpha6'
}
build.gradle (Module: app)
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.google.android.gms:play-services:8.4.0'
}
apply plugin: 'com.google.gms.google-services'
This is a slight variant of #Lord Flash's answer:
For me it wasn't necessarily that I should place the google services plugin at the bottom of the file it was that it should come before the com.android.application plugin.
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.android.application'
Also there are newer binaries than the alpha variants for google-services
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.google.gms:google-services:2.0.0-beta6'
}
}
I'm sure there will be newer ones soon. I found the list of variants here
follow all the steps at this link Add App Invites to Your App
use this : compile 'com.google.android.gms:play-services-appinvite:8.4.0'
instead of this : compile 'com.google.android.gms:play-services:8.4.0'
please follow all the steps and then build the project
hope thats help
I had the same problem, and I found that moving:
apply plugin: 'com.google.gms.google-services'
To the bottom of the module app gradle.
and then use:
classpath 'com.android.tools.build:gradle:2.1.0'
classpath 'com.google.gms:google-services:2.1.0'
The problem is that some of your app dependencies that start with com.google.android.gms: have a version that is incompatible your project dependencie classpath 'com.google.gms:google-services:
Check for these on your app build.gradle
compile 'com.google.android.gms:play-services-plus:8.4.0'
compile 'com.google.android.gms:play-services-analytics:8.4.0'
compile 'com.google.android.gms:play-services-gcm:8.4.0'
compile 'com.google.android.gms:play-services-maps:8.4.0'
And for this in your project build.gradle
classpath 'com.google.gms:google-services:1.5.0'
You can update your project build.gradle to use the latest google-services version or your can just change your app dependencies to use the 8.3 version.
// 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.1.0'
classpath 'com.google.gms:google-services:3.0.0'
// 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
}
// this should solve the gradle update error if it persists even after following above steps
Make sure that the following line is at the end of the app build.gradle file:
compile 'com.google.android.gms:play-services:11.0.2'
google update there API day by day.Now mine is '11.0.2'
try with the updated API