Could not resolve com.android.support:design 28.0.0 - android

I am getting below error in my new Android studio version, when I want add floating EditText. I need to add this android.support.design library if I add this in gradle file
This is errors which i'm getting in logcat
Unable to resolve dependency for ':app#debug/compileClasspath': Could
not resolve com.android.support:design-v7:28.0.0 Open File Show
Details
Unable to resolve dependency for
':app#debugAndroidTest/compileClasspath': Could not resolve
com.android.support:design-v7:28.0.0. Open File Show Details
Unable to resolve dependency for
':app#debugUnitTest/compileClasspath': Could not resolve
com.android.support:design-v7:28.0.0. Open File Show Details
Unable to resolve dependency for ':app#release/compileClasspath':
Could not resolve com.android.support:design-v7:28.0.0. Open File Show
Details
Unable to resolve dependency for
':app#releaseUnitTest/compileClasspath': Could not resolve
com.android.support:design-v7:28.0.0. Open File Show Details
Note: I referred more links I tried all solutions even though I didn't get solution.
I already unchecked offline work in gradle. I added maven also in gradle file and cleaned, rebuilded the project even-though I didn't get solutions.
This is gradle file:
apply plugin: 'com.android.application'
repositories {
maven { url "https://jitpack.io" }
}
android {
compileSdkVersion 28
buildToolsVersion '28.0.3'
defaultConfig {
applicationId "fadila.new_tech.app"
minSdkVersion 16
targetSdkVersion 28
versionCode 6
versionName "1.5"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
}
This is Gradle(PRjoect module)
buildscript {
repositories {
google()
jcenter()
maven {
url 'https://maven.google.com' //put it here
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
maven {
url 'https://maven.google.com' //put it here
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
See Sdk Manager image I already updated 28 version
enter image description here
enter image description here

You can try to compile the package using plus sign
implementation 'com.android.support:design:28.0.+'
or
implementation 'com.android.support:design:28.+'
However google changed the package name, all packages mapping here
All new Support Library development will occur in the AndroidX library
so you have to use
implementation 'com.google.android.material:material:1.0.0'
instead of
implementation 'com.android.support:design:28.0.+'

Close Your Android studio first and then please goes to "C:/Users/" then deleting .android ,.gradle and .AndroidStudio folders.This will delete all current android settings. After the delete process completion you go and then open the studio, when you open the android studio again it will ask for the download dependencies by automatically.
Once Download complete please build your project. it will work.

For me this happened because for some reasons i activated the offline work.
In order to solve this issue i had to deactivate it by going to
File>Settings and then selecting the Build, Execution, Deployment option from the left side of the Settings window. Now click on the Gradle option and then you can see the Offline Work which you can uncheck if it is checked.
But,above all don't forget to check your internet connexion

You can try upgrading this these dependencies:
implementation 'com.android.support:support-v4:27.0.2'
implementation 'com.android.support:appcompat-v7:27.0.2'
implementation 'com.android.support:design:27.0.2'
to:
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:appcompat-v7:28.0.0'

You are having wrong dependency in your gradle
com.android.support:design:28.0.8
latest version current is
com.android.support:design:28.0.0
The version you have used doesn't exist and thus it is producing errors.
Change your dependency to what I have mentioned earlier i.e to version 28.0.0 clean and build your project, If it does not work invalidate caches and restart your andorid studio.

Just disabling the offline mode resolved the issue for me.
Mind you, at the time I am typing this, the latest design library is 28.0.0.

Related

Android studio unable to build my app after gradle plugin updated

I updated the Gradle plugin yesterday and now the android studio is not able to build my app. The app shows the following error.
ERROR: Unable to resolve dependency for ':app#debug/compileClasspath': Could not resolve io.grpc:grpc-core:[1.16.1].
Show Details
Affected Modules: app
ERROR: Unable to resolve dependency for ':app#debugAndroidTest/compileClasspath': Could not resolve io.grpc:grpc-core:[1.16.1].
Show Details
Affected Modules: app
ERROR: Unable to resolve dependency for ':app#debugUnitTest/compileClasspath': Could not resolve io.grpc:grpc-core:[1.16.1].
Show Details
Affected Modules: app
ERROR: Unable to resolve dependency for ':app#release/compileClasspath': Could not resolve io.grpc:grpc-core:[1.16.1].
Show Details
Affected Modules: app
ERROR: Unable to resolve dependency for ':app#releaseUnitTest/compileClasspath': Could not resolve io.grpc:grpc-core:[1.16.1].
Show Details
Affected Modules: app
WARNING: API 'variant.getExternalNativeBuildTasks()' is obsolete and has been replaced with 'variant.getExternalNativeBuildProviders()'.
It will be removed at the end of 2019.
For more information, see https://d.android.com/r/tools/task-configuration-avoidance.
To determine what is calling variant.getExternalNativeBuildTasks(), use -Pandroid.debug.obsoleteApi=true on the command line to display a stack trace.
Affected Modules: app
My app level build.gradle file looks like this:
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.mvp1stockmeter"
minSdkVersion 16
targetSdkVersion 28
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
dataBinding
{
enabled true
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.android.support:multidex:1.0.3'
implementation 'org.jsoup:jsoup:1.11.3'
implementation 'com.google.firebase:firebase-core:16.0.7'
implementation 'com.google.firebase:firebase-firestore:18.0.0'
implementation 'com.google.firebase:firebase-core:16.0.7'
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.9'
implementation 'com.firebaseui:firebase-ui-auth:4.3.1'
implementation 'com.google.firebase:firebase-auth:16.1.0'
//implementation 'com.facebook.android:facebook-android-sdk:4.x'
implementation 'com.jjoe64:graphview:4.2.2'
}
apply plugin: 'com.google.gms.google-services'
My project level build.gradle file looks like this:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
maven {
url 'https://maven.fabric.io/public'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.2'
classpath 'com.google.gms:google-services:4.2.0'
classpath 'io.fabric.tools:gradle:1.26.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
maven {
url 'https://maven.google.com/'
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I searched this on StackOverflow and google as well. But did not find any information. Please help. I am stuck here.
I don't have a clue why this is happening, but it is happening since yesterday, March 21 2019. I think it is a problem in the maven repository? Because the url where android studio is trying to get that library is down.
Anyway, the fix is to "manually" point AS to that missing dependency, adding this line into your build.gradle, inside dependencies{...}
implementation group: 'io.grpc', name: 'grpc-core', version: '1.16.1'
Then sync, then you can delete that line.
Well, I hope someone can explain what happened.
Adding mavenCentral() to allprojects{} section of project level build.gradle file has resolved this issue for me.
Adding mavenCentral() to buildScript{} section of project level build.gradle file has resolved this issue for me. Thanks for your support.
I had three build errors of the following type:
Unable to resolve dependency for ':app#debugUnitTest/compileClasspath': Could not resolve io.grpc:grpc-core:[1.28.0].
As with many of these android studio related issues,
File -> Invalidate Caches / Restart...
did the trick for me.
Delete this line :- testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"...It worked for me
Add mavenCentral() to your buildscripts->repositories and allprojects->repositories both places and sync the project.

Android Studio Build Error - "Failed to resolve: monitor"

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.

Why I can not add my project dependencies?

When I start a new project, I see the following errors about my dependencies.
Actually, I'm using a VPN but I don't know what's the problem?!
And I didn't have this problem before, but now see that since updating my Android Studio, and I should say I searched about this problem a lot but didn't find any solution
Unable to resolve dependency for ':app#debug/compileClasspath': Could not resolve com.google.android.gms:play-services-maps:16.0.0.
Open File
Show Details
Unable to resolve dependency for ':app#debugAndroidTest/compileClasspath': Could not resolve com.android.support.test:runner:1.0.2.
Open File
Show Details
Unable to resolve dependency for ':app#debugAndroidTest/compileClasspath': Could not resolve com.android.support.test.espresso:espresso-core:3.0.2.
Open File
Show Details
Unable to resolve dependency for ':app#debugAndroidTest/compileClasspath': Could not resolve com.google.android.gms:play-services-maps:16.0.0.
Open File
Show Details
Unable to resolve dependency for ':app#debugUnitTest/compileClasspath': Could not resolve com.google.android.gms:play-services-maps:16.0.0.
Open File
Show Details
Unable to resolve dependency for ':app#release/compileClasspath': Could not resolve com.google.android.gms:play-services-maps:16.0.0.
Open File
Show Details
Unable to resolve dependency for ':app#releaseUnitTest/compileClasspath': Could not resolve com.google.android.gms:play-services-maps:16.0.0.
Open File
Show Details
build.gradle (Module:app):
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.pasargad.test_map"
minSdkVersion 19
targetSdkVersion 28
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:28.0.0'
implementation 'com.google.android.gms:play-services-maps:16.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
build.gradle (Project:...):
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
// 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
}
First make sure that you have disabled the gradle offline work like the image below.
Now Connect Pc with the internet. Then Sync your Project Again. It should solve your problem.
make sure that android studio is not in offline mode and re sync with internet connection and if all of those do not work then
1) go to android studio folder on file explorer or something and go to gradle and then look at your gradle file (means version for example mine is gradle-4.6-all and then delete it)
2)go to gradler offilce website and download the same gradle version
gradle official site (for example gradle v4.6)
3)unzip it and paste there where you had been deleted
4)Re sync with internet connection
I found my answer. The problem was because of the proxy info in "gradle.properties" file, I deleted all of the lines about proxy (host, password, etc) and synced the project again

Retrofit 2.4.0 with Gradle plugin 3.1.2

I have a very simple question. I'm an Android Developer returning back to development after a 6 months break and as usual everything has changed apparently. Here is my question:
Start a new Android project on Android Studio 3.1.2
Default Gradle plugin is 3.1.2
Added retrofit2 dependency to app's build.gradle
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
Started gradle sync
Unable to resolve dependency for ':app#debug/compileClasspath': Could
not resolve com.squareup.retrofit2:retrofit:2.4.0. Open File Show
Details
Unable to resolve dependency for
':app#debugAndroidTest/compileClasspath': Could not resolve
com.squareup.retrofit2:retrofit:2.4.0. Open File Show Details
Unable to resolve dependency for
':app#debugUnitTest/compileClasspath': Could not resolve
com.squareup.retrofit2:retrofit:2.4.0. Open File Show Details
Unable to resolve dependency for ':app#release/compileClasspath':
Could not resolve com.squareup.retrofit2:retrofit:2.4.0. Open File
Show Details
Unable to resolve dependency for
':app#releaseUnitTest/compileClasspath': Could not resolve
com.squareup.retrofit2:retrofit:2.4.0. Open File Show Details
I read the whole article about Gradle plugin 3 migration. It is no help.
Project 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.android.tools.build:gradle:3.1.2'
// 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
}
app level build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
buildToolsVersion "27.0.3"
defaultConfig {
applicationId "com.xyz.xyz"
minSdkVersion 15
targetSdkVersion 27
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:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
if your PC is running on some proxy please add proxy in android studio or check your internet connection.
For Proxy follow below steps:
File -> Settings -> Appearence & Behaviour -> System Setting -> HTTP Proxy
add your Proxy
Otherwise check your internet connection
I run your code run with no errors. Try to Invalidate Caches/Restart from: File -> Invalidate Caches/Restart
what worked me is to trying to add it through the project structure dependency window
follow these steps :
1- File -> Project structure -> depencies
click apply then try to sync again and it worked fine for me.

Android Studio Gradle Sync Error using google play-services-maps 11.6.2

I am developing a google map app using Android Studio. When I sync the project with Gradle Files (Select Tools/Android/Sync Project with Gradle Files on Android Studio), I get the following error:
Could not resolve com.google.android.gms:play-services-maps:11.6.2.
Couold not get resource 'https://dl.google.com/dl/android/maven2/com/google/android/gms/play-services-maps/11.62./play-services-maps-11.6.2.pom
This is the software I am using:
Android Studio 3.0.1
Android Version 7.1.1
Google Play Services 46
Google Repository 58 (under Support Repository)
I've tried using both the google maps project template and the empty activity project but I get the same error.
I am using the http proxy setup I used from earlier projects. I am able to install the play-services-maps and the google repository.
I also added the maven url to the Gradle Project file in the All Projects/Repositories section.
I have tried the suggestions from Stack Overflow but none have not worked.
Any ideas?
Gradle Project Build file:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
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()
maven {
url "https://maven.google.com"
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
The gradle app build file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "hansen.scott.googlemaps"
minSdkVersion 25
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.google.android.gms:play-services-maps:11.6.2'
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'
}
The error is in the line:
implementation 'com.google.android.gms:play-services-maps:11.6.2'
try adding this in project level gradle file
allprojects {
repositories {
maven {
url "https://maven.google.com"
}
}
}
Someone had the same issue I did and entered it on Stack Overflow a day or two ago. The user was getting a build error when using player-services-maps 11.6.2. If the user changed the version to 11.0.0, the build succeeded.
Once I back-dated the maps version to 11.0.0, this solved my problem too. I created a new Google Map project and didn't modify the Gradle Build files.
The problem appears to be that play-services-maps won't build using a versions after 11.0.0. I will post the issue on Github.
Thank you for everybody's help.
I have been facing the same issue for the past one week and posted it on Stack Overflow as well but to no effect.
I have since then figured out the root cause. I am working out of my office and thus have firewalls in place. I got it checked with the system admin and on turning off the firewall the build worked.
So i would advice you to have this checked as well.
Kind regards,
Kabir

Categories

Resources