While adding dependency implementation 'com.azoft.carousellayoutmanager:carousel:1.2.4' to my project, Android Studio throws exception Failed to resolve: recyclerview-v7. Then I tried adding dependency for recyclerview. Still getting same error.
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.someapp"
minSdkVersion 16
targetSdkVersion 27
versionCode 1
versionName "1.0"
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation 'com.google.firebase:firebase-crash:16.0.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.squareup.retrofit2:retrofit:2.1.0'
implementation 'com.squareup.retrofit2:converter-gson:2.1.0'
implementation 'com.squareup.okhttp3:logging-interceptor:3.3.1'
implementation 'com.commonsware.cwac:saferoom:0.4.1'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.android.support:cardview-v7:27.1.1'
}
apply plugin: 'com.google.gms.google-services'
I have same problem and i'm change order of repositories in biuld.gradle (app) and problem solved.
Change :
jcenter()
google()
To :
google()
jcenter()
Hope it's help
In Android Studio go to build.gradle (Project: YourProjectName), NOT the build.gradle (Module: app)
Change the code, so it looks like this (switch google() and jcenter()):
allprojects {
repositories {
google()
jcenter()
}
}
Add maven to repositories and it should work
I have no idea why. But my exact same problem has been solved with commenting all of android support dependencies.
It's so strange. But now my project runs without adding another version of these dependencies. When I put only one of these dependencies, I have a warning between ver 27.1.1 and 28.0.0 of support libraries. But I've only used version 28 on this project. It means there is all of these dependencies somewhere in the gradle which obviously is not written by me, or may be it's in the sth like cache (So strange bug).
implementation "com.android.support:support-v4:28.0.0"
implementation "com.android.support:appcompat-v7:28.0.0"
implementation "com.android.support:support-vector-drawable:28.0.0"
implementation "com.android.support:recyclerview-v7:28.0.0"
implementation "com.android.support:design:28.0.0"
implementation "com.android.support.constraint:constraint-layout:1.1.3"
If any of the above solutions did not work try to remove Maven repository and resync again.
this line in build.gradle
maven {
url "https://storage.googleapis.com/snap-kit-build/maven"
}
That's work for me in some projects.
Or replace this line
'com.android.support:recyclerview-v7:27.....'
With this line
'com.android.support:recyclerview-v7:28.0.0-alpha3'
That will solve your problem.
It cannot resolve because the version you are adding might not be in the Maven repository. Check your Api level and choose the appropriate version.
This link might be of help.
Finally I found a solution. Upgrading all the support dependencies to the latest version, solved the issue. You can check the latest version of dependencies here. I upgraded the support dependencies to the latest version 28.0.0-alpha3. It solved my problem.
I had the same error Failed to resolve: recyclerview-v7. Even though project worked before and I just moved it to another machine without changes in gradle files.
Full clear of gradle service folder helped me. By default it is located in C:\Users\username\.gradle
I closed Android Studio and deleted that folder. After that gradle made clean sync and it ended with success.
Maybe deleting of only cached libraries in C:\Users\username\.gradle\caches\modules-2\files-2.1\com.android.support\recyclerview-v7 would help but I didn't check it.
You have to exclude recyclerview-v7 module from the library you want to add:
compile ('YOUR_DEPENDENCY') {
exclude module: 'recyclerview-v7'
}
You have to use for example this dependency: implementation 'com.android.support:recyclerview-v7:28.0.0' in your build.gradle(Module: app) and use 'sync project with Gradle Files' then it will get this dependency. It should work then.
in androidx version I added implementation "androidx.recyclerview:recyclerview:1.1.0" to my gradle and it solved the issue
Related
I had a previously running project, where the versions were upgraded to the latest. Now I cannot build the project due to below build error.
Failed to resolve: monitor Open File
The "Open File" link is to the build.gradle (Module) file. I tried "Invalidate and Restart" which does not help.
Searching under "Failed to resolve: monitor" or "Failed to resolve:" did not result in any solutions.
I am completely stumped at this point.
Module: build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
buildToolsVersion '28.0.3'
defaultConfig {
applicationId "com.example.android.sunshine"
minSdkVersion 14
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
}
}
productFlavors {
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.android.support:preference-v7:28.0.0'
androidTestImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support:support-annotations:28.0.0'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test:rules:1.0.2'
}
I had encountered this problem yesterday whenever I checkout a new branch from a Git repo or create a new project in Android Studio.
Root cause: When I try to build application, the Android Studio show this error
Could not find monitor.jar (com.android.support.test:monitor:1.0.2).
Searched in the following locations:
https://jcenter.bintray.com/com/android/support/test/monitor/1.0.2/monitor-1.0.2.jar
Opening https://jcenter.bintray.com/com/android/support/test/monitor/1.0.2/monitor-1.0.2.jar on a browser I got this error.
{
"errors" : [ {
"status" : 404,
"message" : "Could not find resource"
} ]
}
My assumption is the monitor dependency has been removed (might be temporarily) from jcenter repo. As a result the build process failed. So I figure out 2 solutions:
Solution 1: Go to build.gradle (Project) change the order of repos, so gradle build system will find monitor dependency in google repo first. Fortunately, this dependency is available in the repo (at least so far).
allprojects {
repositories {
jcenter()
google()
}
}
to
allprojects {
repositories {
google()
jcenter()
}
}
Solution 2: Go to build.gradle (Module:App) comment-out or delete these lines. It mean our app do not need the Android Testing Support Library which provides an extensive framework for testing Android apps.
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.android.support:preference-v7:28.0.0'
androidTestImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support:support-annotations:28.0.0'
// Comment-out or delete these lines
// androidTestImplementation 'com.android.support.test:runner:1.0.2'
// androidTestImplementation 'com.android.support.test:rules:1.0.2'
}
Then hit Sync Now.
The problem seems to be with jcenter. I have spent hours together with this problem and your problem seems to be similar to mine and I think the following solution should work.
For some reason and for many libraries in jcenter, the pom files of many libraries are kept in place but corresponding aar files have been removed. This is also the case with play-services-basement library. Check the following here for reference ( pom file of play-services-basement is available at jcentre here but aar file is not available at jcentre here):
Solution :
In your project level gradle file , change the following block of code
allprojects {
repositories {
jcenter()
google()
}
}
to
allprojects {
repositories {
google()
jcenter()
}
}
why this works ?
In our first code block, when gradle tries to resolve a dependency in the repository(in my case,it was google-services-basement in jcentre repository), it ddi not get resolved as corresponding aar files has been removed. As a result , build fails with something like :
Could not find play-services-basement.aar (com.google.android.gms:play-services-basement:15.0.1).
In our second code block, google repository has been referenced before jcenter repository. When gradle build starts, it looks first in the libraries listed first in repositories{... for resolving any library that is used in the project. Now, when gradle tries to resolve play-services-basement in jcenter, it is successful in resolving dependency as corresponding aar file has been made available by google repository(the same aar file of latest version is not available in jcenter repository) which has been referenced before jcenter repository is assessed. Do check and let me know if that works.
I'm using Android Studio 3.2 Beta5 to migrate my project to AndroidX. When I rebuild my app I got these errors:
ERROR: [TAG] Failed to resolve variable '${animal.sniffer.version}'
ERROR: [TAG] Failed to resolve variable '${junit.version}'
Full clean & rebuild did not work! Anyone know how to fix this?
gradle.properties
android.enableJetifier=true
android.useAndroidX=true
build.gradle
buildscript {
repositories {
google()
jcenter()
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0-beta05'
classpath 'com.google.gms:google-services:4.0.1'
classpath "io.realm:realm-gradle-plugin:5.3.1"
classpath 'io.fabric.tools:gradle:1.25.4'
classpath 'com.google.firebase:firebase-plugins:1.1.5'
}
}
allprojects {
repositories {
google()
jcenter()
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
app/build.gradle
apply plugin: 'com.android.application'
apply plugin: 'realm-android'
apply plugin: 'io.fabric'
apply plugin: 'com.google.firebase.firebase-perf'
android {
compileSdkVersion 28
buildToolsVersion "28.0.0"
defaultConfig {
applicationId "com.iceteaviet.fastfoodfinder"
minSdkVersion 16
targetSdkVersion 28
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
}
}
aaptOptions {
cruncherEnabled = false
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
testImplementation 'junit:junit:4.12'
implementation 'com.jakewharton:butterknife:9.0.0-SNAPSHOT'
implementation 'androidx.appcompat:appcompat:1.0.0-rc01'
implementation 'com.google.android.material:material:1.0.0-rc01'
implementation 'androidx.legacy:legacy-support-v4:1.0.0-rc01'
implementation 'androidx.cardview:cardview:1.0.0-rc01'
implementation 'com.google.maps.android:android-maps-utils:0.5'
implementation 'com.google.android.gms:play-services-maps:15.0.1'
implementation 'com.google.android.gms:play-services-location:15.0.1'
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.google.firebase:firebase-database:16.0.1'
implementation 'com.google.firebase:firebase-auth:16.0.1'
implementation 'com.google.android.gms:play-services-auth:15.0.1'
implementation 'com.github.bumptech.glide:glide:4.7.1'
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
implementation 'org.greenrobot:eventbus:3.1.1'
implementation 'de.hdodenhof:circleimageview:2.2.0'
implementation 'io.realm:realm-android-library:5.3.1'
implementation 'com.facebook.android:facebook-android-sdk:4.34.0'
implementation 'io.reactivex.rxjava2:rxandroid:2.0.2'
implementation 'io.reactivex.rxjava2:rxjava:2.0.2'
implementation 'androidx.multidex:multidex:2.0.0'
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.4'
implementation 'com.google.firebase:firebase-perf:16.0.0'
implementation 'com.jakewharton.timber:timber:4.7.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:9.0.0-SNAPSHOT'
annotationProcessor 'com.github.bumptech.glide:compiler:4.7.1'
}
apply plugin: 'com.google.gms.google-services'
I fix this with two steps
1) File -> Invalidate Caches / restart...
2) Build -> Clean project
I got the same error after updating my build.gradle file with AndroidX Test dependencies. Turns out I forgot to remove the old junit dependency. So for me, the fix was simply to remove the following dependency:
dependencies {
...
testImplementation 'junit:junit:4.12'
}
Adding Java 8 support to build.gradle file fixed issue for me
android {
...
//Add the following configuration in order to target Java 8.
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
It seems to be Glide the problem.
I had the same error and I just updated the Glide's dependencies to 4.8 and there is no build errors.
Kotlin :
// Glide
def glide_version = "4.8.0"
implementation "com.github.bumptech.glide:glide:$glide_version"
kapt "com.github.bumptech.glide:compiler:$glide_version"
Java :
// Glide
def glide_version = "4.8.0"
implementation "com.github.bumptech.glide:glide:$glide_version"
annotationProcessor "com.github.bumptech.glide:compiler:$glide_version"
Be sure to have enabled in your gradle.properties :
android.useAndroidX=true
android.enableJetifier=true
Source : https://github.com/bumptech/glide/issues/3124
Hope this will help you!
Fixed it by going to the main directory and typing flutter clean
Removing the testInstrumentationRunner worked for me:
defaultConfig {
...
...
// testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
If you're using Kotlin, the issue will popup if don't use the kapt version for any annotation processor you use in the project.
As #Vince mentioned the case with Glide, this could happen with Dagger2, Butterknife, etc.
If you're using both Java and Kotlin you'll need to keep both dependencies, as follows (were $glideVersion is a predefined version of Glide):
implementation "com.github.bumptech.glide:glide:$glideVersion"
kapt "com.github.bumptech.glide:compiler:$glideVersion"
If you're on a Kotlin only project, the kapt dependency should work alone.
EDIT
Another thing you should have in mind is if you're already using Androidx. Androidx is a great refactor but when migrating it can cause some of your dependencies to collapse. Mainstream libraries are already updated to Androidx, however, some of them are not and even won't.
If the issue doesn't go away with my provided solution above this edit, you can take a look at your dependencies and make sure they use Androidx as well.
EDIT 2
As #Ted mentioned, I researched back and he's right kapt does handle java files as well. kapt alone will do the trick, no need to keep both kapt and annotationProcessor dependencies.
Try removing this line:
maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
from the buildscript / repositories section of your build.gradle file.
When I added that line, I got the error you described. When I removed it, no longer. That line should only be in the allprojects / repositories section.
Try set android.enableJetifier=false in gradle.properties. Then Invalidate Caches / Restart ... in Android Studio
The fix is in 4.2.0, use the higher version of google gms jar.
Try changing:
classpath 'com.google.gms:google-services:4.0.1'
by this version:
classpath 'com.google.gms:google-services:4.2.0'
Hope this works...
If you are using dagger or butterknife, please make sure to update it to the latest version. Or, if you have another injection library used in your project, you can try to check it if it support androidx or no.
I've found same error, the problem is on my dagger and butterknife. Have fixed it by updating it to newest version.
Android version: 4.10.2
I solved this issue with three simple steps:
First i added below this in pubspec.yml:
(with two spaces of identation)
module:
androidX: true
Adding this two lines below in gradle.properties, i have this in android/gradle.properties, in the project folder.
android.useAndroidX=true
android.enableJetifier=true
And after this i wrote with the terminal:
flutter clean
Maybe you will have to stop the device and run again.
I fixed this by updating the firebase dependencies to the latest.
I faced this error after adding butterknife to my project.
In order to resolve this error you should use Java8.
I would recommend this answer.
How I resolved it:
1.add following code in build.gradle (module: app)
android {
...
// Configure only for each module that uses Java 8
// language features (either in its source code or
// through dependencies).
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
clean prject and run.
I fixed it by refreshing the cahche (Instead of invalidating it - which also clears the local history):
in gradle.properties file, comment the line org.gradle.caching=true.
Clean, Rebuild.
in gradle.properties file, un-comment the line
org.gradle.caching=true.
Clean, Rebuild.
Thats it!
Go to file and click on Invalidate caches and restart.
After it restarts then you increase the minimum SDK version in your app's build.gradle file.
I already looked at every other questions and googled the impossible but I cannot find a way to use correct dependencies. Below there is my app Gradle build file:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.0-alpha01'
}
}
apply plugin: 'com.android.application'
repositories {
jcenter()
google()
}
android {
compileSdkVersion 27
Hey just exclude the appcompat dependencies from the libraries which are using an older version of appcompat and support libraries. If you don't have these support libraries in your project then include them. In your question, braintreepayments is one of the libraries which using an older version of card view and design library. Try changing your gradle dependencies to
dependencies {
...
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation ('com.braintreepayments.api:drop-in:3.0.0'){
exclude group: 'com.android.support'
}
...
}
You should either downgrade appcompat library so its version be lowe then build tools version but still 27th, or upgrade build tools version up to appcompat. Check different compounds to find completely the same verstion
Remove buildToolsVersion "27.0.3" from your gradle file.
Or you should check this-- buildToolsVersion "27".
Good luck
(Posted on behalf of the question author).
The problem, as mudit_sen helped me find out, was the Braintree dependency:
implementation 'com.braintreepayments.api:drop-in:3.0.0'
I removed that line as I don't need it and it was from a previous project and now everything is working as intended. Thank you very much.
Update
For people that wants to use Braintree library the solution to me was to use
implementation 'com.android.support:appcompat-v7:27.0.0'
implementation 'com.android.support:support-v4:27.0.0'
with
implementation 'com.braintreepayments.api:drop-in:3.4.0'
I know about this questions:
Failed to resolve: com.android.support:cardview-v7:26.0.0 android
Could not resolve com.android.support:appcompat-v7:26.1.0 [duplicate]
And I've read this documentations:
Migrate to Android Plugin for Gradle 3.0.0
Migrating to Android 8.0
So I'm posting this question believing its not a duplicate.
I've installed Android Studio 3.0.1. I didn't have any previous version before and I started a new project.
Every setting in Gradle file have been set by Android Studio itself and I've checked them all.
These are the file contents:
build.gradle (Module:app)
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.example.administrator.as301test"
minSdkVersion 16
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'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:design:26.1.0'
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'
}
Top level build.gradle
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
// 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
}
gradle-wrapper.properties
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
I use google() in repositories as here clearly says:
// If you're using a version of Gradle lower than 4.1, you must instead use:
// maven {
// url 'https://maven.google.com'
// }
My gradle version is 4.1 so I don't need above code.
But I still get this error as the others have been asking about:
Error:Unable to resolve dependency for ':app#debug/compileClasspath':
Could not resolve com.android.support:appcompat-v7:26.1.0.
Why should I get this error when I'm creating a new project in AS 3.0.1 and it has been set all the necessary settings?
Update
#Rohit's answer somehow solved the issue but I still get same error for some other dependencies.
Could not resolve com.android.support.test:runner:1.0.1
Could not resolve
com.android.support.test.espresso:espresso-core:3.0.1
Could not resolve junit:junit:4.12
Finally I fixed the problem by modifying build.gradle like this:
android {
compileSdkVersion 26
buildToolsVersion "26.0.2"
defaultConfig {
minSdkVersion 16
targetSdkVersion 26
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:design:26.1.0'
}
I've removed these lines as these will produce more errors:
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'
Also I had same problem with migrating an existing project from 2.3 to 3.0.1 and with modifying the project gradle files like this, I came up with a working solution:
build.gradle (module app)
android {
compileSdkVersion 27
buildToolsVersion "27.0.1"
defaultConfig {
applicationId "com.mobaleghan.tablighcalendar"
minSdkVersion 16
targetSdkVersion 27
}
dependencies {
implementation 'com.android.support:appcompat-v7:25.1.0'
implementation 'com.android.support:design:25.1.0'
implementation 'com.android.support:preference-v7:25.1.0'
implementation 'com.android.support:recyclerview-v7:25.1.0'
implementation 'com.android.support:support-annotations:25.1.0'
implementation 'com.android.support:support-v4:25.1.0'
implementation 'com.android.support:cardview-v7:25.1.0'
implementation 'com.google.android.apps.dashclock:dashclock-api:2.0.0'
}
Top level build.gradle
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
goto Android->sdk->build-tools directory make sure you have all the versions required . if not , download them . after that
goto File-->Settigs-->Build,Execution,Depoyment-->Gradle
choose use default gradle wapper (recommended)
and untick Offline work
gradle build finishes successfully for once you can change the settings
If it dosent simply solve the problem
check this link to find an appropriate support library revision
https://developer.android.com/topic/libraries/support-library/revisions
Make sure that the compile sdk and target version same as the support library version.
It is recommended maintain network connection atleast for the first time build (Remember to rebuild your project after doing this)
try this :
android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
targetSdkVersion 26
}
}
compile 'com.android.support:appcompat-v7:25.1.0'
It has worked for me
I tried all of the above and nothing worked for me.
Then I followed Gradle Settings > Build Execution, Deployment > Gradle > Android Studio and checked "Disable embedded Maven repository".
Did a build with this checked and the problem was solved.
Just go to
File\Settings\Gradle. Deselect the "Offline work" box. Now you can connect and
download any necessary or missing dependencies
Your android studio may be forgot to put :
buildToolsVersion "26.0.0"
you need 'buildTools' to develop related design and java file. And if there is no any buildTools are installed in Android->sdk->build-tools directory then download first.
well got this answer from another site and don't want to take any credit for this but this solution works like butter.
Go to File\Settings\Gradle. Deselect the "Offline work" box. Now you can connect and download any necessary or missing dependencies.
This work for me. In the android\app\build.gradle file you need to specify the following
compileSdkVersion 26
buildToolsVersion "26.0.1"
and then find this
compile "com.android.support:appcompat-v7"
and make sure it says
compile "com.android.support:appcompat-v7:26.0.1"
OK It's A Wrong Approach But If You Use it Like This :
compile "com.android.support:appcompat-v7:+"
Android Studio Will Use The Last Version It Has.
In My Case Was 26.0.0alpha-1.
You Can See The Used Version In External Libraries (In The Project View).
I Tried Everything But Couldn't Use Anything Above 26.0.0alpha-1, It Seems My IP Is Blocked By Google. Any Idea? Comment
In my case, this error occur when i tried to use gridView
I resolved it by removing this line from build.grade(Module) file
implementation 'com.android.support:gridlayout-v7:28.0.0-alpha3'
This issue seems to like the following.
How to resolve repository certificate error in Gradle build
Below steps may help:
1. Add certificate to keystore-
Import some certifications into Android Studio JDK cacerts from Android Studio’s cacerts.
Android Studio’s cacerts may be located in
{your-home-directory}/.AndroidStudio3.0/system/tasks/cacerts
I used the following import command.
$ keytool -importkeystore -v -srckeystore {src cacerts} -destkeystore {dest cacerts}
2. Add modified cacert path to gradle.properties-
systemProp.javax.net.ssl.trustStore={your-android-studio-directory}\\jre\\jre\\lib\\security\\cacerts
systemProp.javax.net.ssl.trustStorePassword=changeit
Ref : https://www.cresco.co.jp/blog/entry/2014//
Try to clear cache in android studio by
File-> Invalidate cache -> invalidate
after invalidating
build-> clean project
Then you can able to build the project
this work for me
compile 'com.android.support:appcompat-v7:26.0.0'
change 26.0.0 to 26.0.1
compile 'com.android.support:appcompat-v7:26.0.1'
this work for me. add configurations.all in app/build.gradle
android {
configurations.all {
resolutionStrategy.force 'com.android.support:support-annotations:27.1.1'
}
}
I've been trying to setup Firebase in my Android project.
Problem is, I've been getting this error:
Could not parse the Android application Module's Gradle Config
And I really can't solve it.
I've seen quite a lot of people getting this error, but it seems that they could solve it by upgrading their build tool version, or by updating google-services. I've done all that and haven't been able to make it work so far.
Here are my Gradle scripts:
apply plugin: 'com.android.application'
android {
signingConfigs {
AndroidAppPro {
}
}
compileSdkVersion 25
buildToolsVersion '26.0.0'
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "com.critizr.pro"
minSdkVersion 14
targetSdkVersion 25
versionCode 9
versionName "1.5.1"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
productFlavors {
preprod {
applicationId "com.cr.pro"
buildConfigField 'boolean', 'IS_PROD', 'false'
buildConfigField 'String', 'HOST', '"https://myurl.com/"'
}
prod {
applicationId "com.cr.pro"
buildConfigField 'boolean', 'IS_PROD', 'true'
buildConfigField 'String', 'HOST', '"https://myurl/"'
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'
}
}
dependencies {
compile project(':lib-viewflow')
// new libs
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:appcompat-v7:25.2.0'
compile 'com.android.support:support-v4:25.2.0'
compile 'com.android.support:cardview-v7:25.2.0'
compile 'com.android.support:recyclerview-v7:25.2.0'
compile 'com.google.android.gms:play-services-gcm:11.0.2'
compile 'com.google.android.gms:play-services-maps:11.0.2'
//compile 'com.google.android.gms:play-services-analytics:11.0.1'
compile 'org.apache.httpcomponents:httpclient:4.1'
compile 'org.apache.httpcomponents:httpmime:4.1'
compile 'com.joshdholtz.sentry:sentry-android:1.5.0'
compile 'com.borax12.materialdaterangepicker:library:1.6'
compile 'com.github.PhilJay:MPAndroidChart:v2.2.5'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.cloudinary:cloudinary-core:1.2.2'
compile 'com.cloudinary:cloudinary-android:1.2.2'
compile 'com.loopj.android:android-async-http:1.4.5'
}
apply plugin: 'com.google.gms.google-services'
And the second one:
buildscript {
repositories {
jcenter()
maven { url "https://jitpack.io" }
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.1'
classpath 'com.google.gms:google-services:3.1.0'
}
}
allprojects {
repositories {
jcenter()
maven { url "https://jitpack.io" }
}
}
For me by removing the warning of jCenter worked
jCenter() remove it..
To solve this on Android Studio v3.1 (not sure about previous versions), just edit your app's build.gradle like this:
Look for:
apply plugin: 'com.google.gms.google-services' and remove it then sync. Now you'll be able to use the Firebase Assistant with no issues.
Verify the build tab, and make sure you've got no warnings in there.
Firebase Assistant seems to be very sensitive to any Gradle info, warning, or error.
For me it was a simple "info" from gradle, that databinding.enabled is not required anymore:
DSL element 'android.dataBinding.enabled' is obsolete and has been replaced with 'android.buildFeatures.dataBinding'.
Once removed, Firebase Assistant worked fine.
The Navigation Component's safeargs plugin can also cause this. To fix it, I temporarily removed id 'androidx.navigation.safeargs.kotlin' from app-level build.gradle file and then added it back in afterwards.
Commenting out apply plugin: io.fabric worked for me. So check your dependencies in your gradle file.
I think some of your dependencies are behind it . Just go to your build.gradle (module app) and comment out most of them or all of them (to find out which one) , sync again ignore all error for now and try connecting to firebase again if it's successful then you can go back to your build.gradle and uncomment them to fix errors.
Hope this helps
I had a problem for viewBinding. Did as in the instructions from Google and it all worked.
android {
...
buildFeatures {
viewBinding true
}
}
My problem was the jcenter Repository, because it is deprecated since March 31st 2021, see: https://developer.android.com/studio/build/jcenter-migration
I replaced jcenter() with mavenCentral(). Now it works.
change the gradle build tool version to 3.0.1
This error occurs due to depreciation of the Compile keyword in built.gradle(app level)
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'. It will be removed at the end of 2018.
Its Solution is to
Just replace the compile keyword with implementation or api in built.gradle(app level)
&
Rebuilt your project
Restart your Android Studio if not Solved after Rebuilt.
Conclusion
The real culprit is the warnings of your build.gradle. Firebase assistant is very sensitive, it checks for any warning (even deprecated one) in your build.gradle & then starts working. If it finds any, then you will get this error.
Solution
Just remove or resolve every warning of the build.gradle file. also, remove plugins that already exist of the same thing you are adding.
Remove all previous Firebase dependencies in your project and try again. Plugins and libraries.
I had this issue before because I had already setup Firebase manually.
Hope it helps.
If you are not use databinding remove from your app level gradle
dataBinding {
enabled = true
}
Remove these lines from your app level gradle
In my case this was caused because I used data binding in my project. Here is how I fixed the issue:
In your build.gradle(App level) set the dataBinding as follow:
Put this code in your build.gradle(Project level) under the buildTypes:
//Here is the code...
buildFeatures {
dataBinding = true
}
Follow the solution step by step.
1. In Gradle Script/build.gradle(Project:your project name):
Add dependencies
dependencies {
classpath "com.android.tools.build:gradle:4.2.1"
classpath 'com.google.gms:google-services:4.3.8'
}
}
jcenter remove or do comment out:
allprojects {
repositories {
google()
mavenCentral()
// jcenter() // Warning: this repository is going to shut down soon
}
}
2. In Gradle Script/gradle.properties:
android.useAndroidX=true
3. In Gradle Script/build.gradle(:app):
plugins {
id 'com.android.application'
id 'com.google.gms.google-services'
}
before build types add buildFeatures:
buildFeatures {
dataBinding = true
}
at the last:
dependencies {
implementation platform('com.google.firebase:firebase-bom:28.0.1')
implementation 'com.google.firebase:firebase-analytics'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'com.google.firebase:firebase-database:20.0.0'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}
4. Add google servises json file
location:
D:\AndroidStudioProjects\Whatsup_project\app
See the youtube video on how to add a JSON file.
In my case most of the dependencies were included with compile rather than implementation. So converting compile to implementation in my build.gradle(Module : app) worked perfectly
in case of flutter project after commenting this line worked for me
//apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
After very long trying many things.
this solved me : changing google services version to 4.2.0 in build gradle
classpath 'com.google.gms:google-services:4.2.0'
now my build gradle looks like this:
buildscript {
repositories {
google()
jcenter()
dependencies {
classpath 'com.android.tools.build:gradle:3.6.1'
}
}
dependencies {
classpath 'com.google.gms:google-services:4.2.0'
}
allprojects {
repositories {
google()
jcenter()
}
}
}
When I was facing this problem I have simply removed 20.0.1 from,
implementation 'com.google.firebase:firebase-auth:20.0.1'
(NOTE: I have implemented firebase-boM first so it has occurred in my case.)
Then synced and tried reconnecting then it was successful.
I think it occurs for many reasons.
If you are using firebase boM. then don't specify any other firebase dependencies versions. after successful sync, it should be solved.
In your case, I can not declear why it is happening.
What solved my issue was:
deleting
databinding{enabled = true}
and inserting
buildFeatures{dataBinding = true}
Basically, you need to remove all the gradle warning before doing this. In my case, I used buildFeatures { viewBinding true}
instead of
buildFeatures { dataBinding true }
I also face this problem and I found the best way to solve this problem is: connect your Application manually to the firebase database.
To enable google firebase services in your app you need to add google services plugin to your gradle file(build.gradle). so in the gradle file
under dependencies add :
classpath 'com.google.gms:google-services:4.3.0' // Google Services plugin
under repositories check that you have Google's Maven repository as
google() //Google's Maven repository
For detailed breakdown on how to set up firebase check here for the official documentation.
Remove following from Gradle
testImplementation 'junit:junit:'
This worked for me and also connected to Firebase without any issue, you just need to rebuild project and then click on connect to firebase. It's done.
I just had a similar issue. I had to delete useProguard from the buildTypes in your app gradle.
After that I did not get the warning any more
In my case, I had to change minSdkVersion in build.gradle(Module: app) file to 25 and it worked.
in my case i update the minSdkVersion in build.gradle to the last one 28.0.3 and after i sync it work fine
This worked for me!
Go to Gradle.properties in your android
Disable android.enableR8=true by adding a # in front:
#android.enableR8=true
Alternatively, you can swap out the R8 for D8, The build system changed to using D8 instead of R8.
android.enableD8=true
Change the versions to below.
dependencies {
classpath "com.android.tools.build:gradle:3.6.1"
classpath 'com.google.gms:google-services:4.3.3'
}
Try changing the Android Gradle Plugin Version to 4.1.3 and the Gradle Version to 6.5 in Project Structure. It helped me and it might help you too. Android Firebase: Could not parse