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.
Related
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.
I am getting this error:
Here is my build.gradle(Module:app)
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.mycompany.myapp"
minSdkVersion 19
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dataBinding.enabled = true
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.google.firebase:firebase-core:15.0.0'
compileOnly "org.projectlombok:lombok:1.16.20"
annotationProcessor 'org.projectlombok:lombok:1.16.20'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation 'com.google.code.gson:gson:2.8.1'
implementation 'com.android.volley:volley:1.1.0'
implementation 'com.android.support:design:26.1.0'
implementation 'com.android.support:support-v4:26.1.0'
implementation 'com.google.android.gms:play-services-maps:15.0.0'
implementation 'com.google.android.gms:play-services-location:15.0.0'
implementation 'com.google.android.gms:play-services-places:15.0.0'
implementation 'com.paytm.pgsdk:pgsdk:1.0.8'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
compile 'com.crashlytics.sdk.android:crashlytics:2.9.1'
}
apply plugin: 'com.google.gms.google-services'
and Here is my build.gradle(Project: myApp)
buildscript {
repositories {
google()
jcenter()
maven {
url 'https://maven.fabric.io/public'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'io.fabric.tools:gradle:1.25.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.gms:google-services:3.1.0'
}
}
allprojects {
repositories {
google()
jcenter()
maven {
url 'https://maven.google.com/'
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I have checked other solutions, most of them suggest to add
maven { url "https://maven.google.com" }
to build.gradle of project. I have already tried this but I am still getting same error.
I am on android studio 3.0.
I have also tried adding google() instead of maven (another suggestion)
OPTION 1:
Follow the below instruction to resolve it.
Project-level build.gradle
use
maven { url "https://www.jitpack.io" }
instead of
maven { url "https://jitpack.io" }
OPTION 2:
Project-level build.gradle
google() repository should be 1st priority
allprojects {
repositories {
google()
mavenLocal()
jcenter()
}
}
OPTION 3:
Follow the below steps to resolve it.
Step1:
Project-level build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.google.gms:google-services:4.2.0' // google-services plugin
classpath 'com.android.tools.build:gradle:3.4.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
maven { url "http://dl.bintray.com/populov/maven" }
maven { url "https://jitpack.io" } // For Ucrop
maven { url "https://maven.google.com" } // Google's Maven repository - FCM
maven {
url 'https://dl.bintray.com/azeesoft/maven'
}
google()
jcenter()
mavenCentral()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Step2:
App-level build.gradle
I have update One Signal version.
use
implementation 'com.onesignal:OneSignal:3.11.1'
instead of
implementation 'com.onesignal:OneSignal:3.10.9'
I had the same issue while use OneSignal to handle push notifications in my android application.
The solution is to add the exclude clause to its' dependency:
implementation ('com.onesignal:OneSignal:3.8.3'){
exclude group: 'com.google.android.gms'
}
in the app folder, then add any other missing dependency manually such as:
implementation 'com.google.android.gms:play-services-appinvite:16.1.0'
The problem is that OneSignal SDK contains Google Play Service dependency that are not of the same version with the latest version of gms and firesbase I used in the app.
So I suggest you figure out a dependency you added that uses google play service in the project and use the exclude clause on it. Though your gradle should build if your system is connected to the internet.
Hope this is helpful.
Go to File → Other Settings → Default Settings → Build, Execution, Deployment → Build Tools → Gradle → uncheck Offline work option.
I was using a VPN for internet connection. I closed VPN and it worked for me.
Using the VPN solved my problem.
I had this problem and I was using a proxy before. I figured out that my proxy is not working any more so i went to settings and changed the proxy config to Automatic but still the same error was being shown.
I finally found that the proxy was also automatically set to gradle as well but when I disabled it, it wasn't removed from my gradle config. so I went to C:Users/User/.gradle/gradle.properties and in that file there was something like this:
## For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
#enter code here
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx1024m -XX:MaxPermSize=256m
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
#
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
#Sat Aug 31 18:23:27 IRDT 2019
systemProp.https.proxyPort=8118
systemProp.http.proxyHost=fodev.org
systemProp.https.proxyHost=fodev.org
systemProp.http.proxyPort=8118
so I just edited this file and commented the last 4 lines and it solved my problem.
I am also using a VPN service.
My issue was...
I can run the project... but suddenly this error came up.
After few tried "Try Again" Solution but not solving.
Finally after few minutes wasted. I Try Clean Project. And Rebuild. Tadaaaa it work.
i dont know if this will help anybody but it solve my issue. hope it solve yours.
Open top-level build.gradle file and add google-services:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.6.3'
classpath 'com.google.gms:google-services:4.3.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
also if you already have it added simply update google-service and gradle to the latest
If this problem occurred to you suddenly, it may be that it was corrupted while generating the apk. This rarely happens
Solution: rebuild tasks
you can see it in this image
An update of the repository to the latest version solved the problem for me.
implementation 'com.google.android.gms:play-services-ads-identifier:17.0.1'
In my case I just changes my just changes my project level build Gradle and other dependencies to the latest and the Google Maps dependency in app level build gradle to 10.0.0.
Just Build → Clean Project worked for me
Have you tried adding this in your dependencies:
implementation 'com.google.android.gms:play-services-basement:15.0.0'
I am building a project in android studio 3.0 with android plugin 'com.android.tools.build:gradle:3.0.0-alpha1' and gradle version gradle-4.0-milestone-1-all.zip.
Used maven repo as well:
maven {
url 'https://maven.google.com'
}
Also, Using android Room persistence and lifecycle in my project. Already declared below dependencies in my app gradle file:
compile "android.arch.lifecycle:extensions:1.0.0-alpha1"
compile "android.arch.persistence.room:runtime:1.0.0-alpha1"
annotationProcessor "android.arch.lifecycle:compiler:1.0.0-alpha1"
annotationProcessor "android.arch.persistence.room:compiler:1.0.0-alpha1"
When Sync and build the project it's showing below error:
Failed to resolve: android.arch.lifecycle:extensions:1.0.0-alpha1
Am I missing something or any other solution for this issue.
I have fixed the issue by updating my app build.gradle file like below:
// 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:3.0.0-alpha2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven { url 'https://maven.google.com' }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Actually had to remove the maven repository from buildscript repositories and added to allprojects repositories as shown above. Also you can keep the maven repository at both places but must include in allprojects repositories to fix the issue.
Add in app/gradle file
compile "android.arch.lifecycle:extensions:1.0.0-alpha4"
compile "android.arch.persistence.room:runtime:1.0.0-alpha4"
annotationProcessor "android.arch.lifecycle:compiler:1.0.0-alpha4"
annotationProcessor "android.arch.persistence.room:compiler:1.0.0-alpha4"
add maven to project based gradle
allprojects {
repositories {
jcenter()
maven { url 'https://maven.google.com' }
}
}
it will compile easily
am find solution work with me Room
Dependencies for Room, including testing Room migrations and Room RxJava
dependencies {
def room_version = "1.1.1"
implementation "android.arch.persistence.room:runtime:$room_version"
annotationProcessor "android.arch.persistence.room:compiler:$room_version" // use kapt for Kotlin
// optional - RxJava support for Room
implementation "android.arch.persistence.room:rxjava2:$room_version"
// optional - Guava support for Room, including Optional and ListenableFuture
implementation "android.arch.persistence.room:guava:$room_version"
// Test helpers
testImplementation "android.arch.persistence.room:testing:$room_version"
}
as the document says: https://developer.android.com/topic/libraries/architecture/adding-components
you can change "https://maven.google.com" to "https://dl.google.com/dl/android/maven2/" to solve the problem.
You require latest gradle version 'com.android.tools.build:gradle:3.0.0-alpha2' and Studio Version 3.0+ to use Room
Just add maven { url 'https://maven.google.com' } to your project gradle
open preference for mac or you can open setting for windows then search proxy setting inside the open window then unchecked proxy authentication it will work
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.
I am facing this issue once I put the dependency of GCM.
Error:(50, 0) Gradle DSL method not found: 'comiple()'
Possible causes:The project 'everybill-codebase' may be using a version of Gradle that does not contain the method.
Open Gradle wrapper fileThe build file may be missing a Gradle plugin.
Apply Gradle plugin
This is the build.gradle file of line no 50,
comiple 'com.google.android.gms:play-services-gcm:8.4.0'
I am using these services also from play-service
compile 'com.google.android.gms:play-services-maps:8.4.0'
compile 'com.google.android.gms:play-services-identity:8.4.0'
compile 'com.google.android.gms:play-services-analytics:8.4.0'
compile 'com.google.android.gms:play-services-location:8.4.0'
this is the build.gradle file in project
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.0.0-alpha6'
classpath 'com.google.gms:google-services:2.0.0-alpha6'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
It would be great to know any solution related with this. Thanks in advance.
Eventually someone is going to close this question, but as the other guys pointed out it's just a typo, use compile() instead of comiple().