Android studio unable to build my app after gradle plugin updated - android

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.

Related

Error in library built with jitpack: Unable to resolve dependency for ':app#debug/compileClasspath'

I am trying to publish my android library on jitpack.io but when I tried to add dependency to test my artifact I am getting this error:
Unable to resolve dependency for ':app#debug/compileClasspath': Could not resolve com.github.pashaoleynik97:GSBarcodeScannerHelper:0.1.1-alpha.
Open File
Show Details
Unable to resolve dependency for ':app#debugAndroidTest/compileClasspath': Could not resolve com.github.pashaoleynik97:GSBarcodeScannerHelper:0.1.1-alpha.
Open File
Show Details
Unable to resolve dependency for ':app#debugUnitTest/compileClasspath': Could not resolve com.github.pashaoleynik97:GSBarcodeScannerHelper:0.1.1-alpha.
Open File
Show Details
Unable to resolve dependency for ':app#release/compileClasspath': Could not resolve com.github.pashaoleynik97:GSBarcodeScannerHelper:0.1.1-alpha.
Open File
Show Details
Unable to resolve dependency for ':app#releaseUnitTest/compileClasspath': Could not resolve com.github.pashaoleynik97:GSBarcodeScannerHelper:0.1.1-alpha.
Open File
Show Details
My gradle files in library project are listed below.
My build.gradle (app):
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.github.pashaoleynik97.gsbarcodescannerhelperdemo"
minSdkVersion 21
targetSdkVersion 28
versionCode 2
versionName "1.1"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
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:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
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 project(':gsbarcodescannerhelper')
}
My build.gradle (gsbarcodescannerhelper):
apply plugin: 'com.android.library'
group='com.github.pashaoleynik97;'
android {
compileSdkVersion 28
defaultConfig {
minSdkVersion 21
targetSdkVersion 28
versionCode 2
versionName "0.1.1"
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'
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 'org.jetbrains.kotlin:kotlin-stdlib:1.3.10'
implementation(name: 'generalscan-sdk-1.0.6', ext:'aar')
}
And finally, my build.gradle (project):
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
flatDir {
dirs project(':gsbarcodescannerhelper').file('libs')
}
maven { url 'https://jitpack.io' }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I pushed my project on github, created release (through github web interface), then went to jitpack.io and published my library. But when I tried to add this library to my new test project I had errors (listed in top of this post). What I am doing wrong?
UPD
I also tried to add classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1' like in this docs: https://jitpack.io/docs/ANDROID/
But result remains the same.
UPD 2
Created issue: https://github.com/jitpack/jitpack.io/issues/3758
This seems to be a persisting issue for a few days, can be found here, the link mentions a workaround here. The workaround is to add www with the jitpack.io. Hence update it to the following:
maven { url 'https://www.jitpack.io' }
Jitpack is very sensative tool. There are a multitude of reasons why this issue comes up. I will try to itemized them.
1) Failing Unit Tests; if you have any failing unit tests, you will be able to create the artifact on jitpack (with no reported issues) but will be unable to reference the artifact. Make sure all your unit tests are working properly.
2) It is advisable that you include in your project level gradle for the project intended to be the artifact, the following:
Top of Project Level Gradle
apply plugin: 'maven-publish'
group = '<add-your-package-name-here>'
and at the very bottom of your project level gradle include
apply from: 'https://raw.githubusercontent.com/sky-uk/gradle-maven-plugin/master/gradle-mavenizer.gradle'
Now generate an artifact and see if the reference works
3) Private artifact? Maybe you are not referencing your artifact correctly. If your repo is private, be sure to add the auth token in gradle.properties and then reference it on the project level gradle like this,
gradle.properties
authToken=jp_myfake_token
Project Level Gradle:
maven {
url "https://jitpack.io"
credentials{ username authToken }
}
4) Wait a hour. For whatever reason there is syncing and caching issues with Jitpack. Sometimes all you have to do is wait a hour (or two) and everything starts to work.
Hopefully one of these will help you resolve your issue. Jitpack has easy setup, but it is buggy.
make sure that you add maven { url "https://jitpack.io" }
in build.gradle (Project Level) like this:
allprojects {
repositories {
google()
jcenter()
maven { url "https://jitpack.io" }
}
}
also, make sure that's your Gradle offline mode is disabled
Now it is free only for public repositories...
If you put your repository url in https://jitpack.io and looked up, you will see the following message as log:
Subscription not active

Gradle Project Sync Failing

My Project Sync is failing with the below errors -
Unable to resolve dependency for ':app#debug/compileClasspath': Could not download exoplayer-core.aar (com.google.android.exoplayer:exoplayer-core:r2.4.2)
Unable to resolve dependency for ':app#debugAndroidTest/compileClasspath': Could not download exoplayer-core.aar (com.google.android.exoplayer:exoplayer-core:r2.4.2)
Unable to resolve dependency for ':app#debugUnitTest/compileClasspath': Could not download exoplayer-core.aar (com.google.android.exoplayer:exoplayer-core:r2.4.2)
Unable to resolve dependency for ':app#release/compileClasspath': Could not download exoplayer-core.aar (com.google.android.exoplayer:exoplayer-core:r2.4.2)
Unable to resolve dependency for ':app#releaseUnitTest/compileClasspath': Could not download exoplayer-core.aar (com.google.android.exoplayer:exoplayer-core:r2.4.2)
My Project build.grade looks like this -
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.google.gms:google-services:4.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
google()
maven {
url "https://maven.google.com"
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
And my App gradle file looks like -
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
buildToolsVersion '28.0.3'
defaultConfig {
applicationId "com.android.application"
minSdkVersion 15
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'])
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.google.android.gms:play-services-ads:17.1.2'
implementation 'com.google.android.gms:play-services-analytics:16.0.6'
testImplementation 'junit:junit:4.12'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.facebook.android:audience-network-sdk:5.1.0'
}
Any help in this regard would be appreciated!!!
How do I resolve this??
I have tried Invalidate Caches/Restart option and also tried to rebuild the project but it didn't help..
It seems that Exoplayer-core and Exoplayer-dash are broken since today
https://github.com/google/ExoPlayer/issues/5225
By this Gradle configuration it works fine :
android {
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
compileSdkVersion 27
defaultConfig {
...
targetSdkVersion 27
...
}
}
ext {
exoplayer_version = '2.9+'
}
dependencies {
...
//exoplayer
implementation ('com.google.android.exoplayer:exoplayer-core:' + exoplayer_version)
implementation ('com.google.android.exoplayer:exoplayer-dash:' + exoplayer_version)
implementation ('com.google.android.exoplayer:exoplayer-hls:' + exoplayer_version)
implementation ('com.google.android.exoplayer:exoplayer-smoothstreaming:' + exoplayer_version)
implementation ('com.google.android.exoplayer:exoplayer-ui:' + exoplayer_version)
implementation ('com.google.android.exoplayer:exoplayer:' + exoplayer_version)
So for sure if you didn't include exoplayer library in your
build.gradle, your project won't synch.
UPDATE:
Okay, sorry, now I got the problem you all using com.facebook.android:audience-network-sdk have experienced these days, and why in your build.gradle file there is not exoplayer dependency set.
Using com.facebook.android:audience-network-sdk that depends on exoplayer, if you didn't explicitly specify exoplayer-core and exoplayer-dash, gradle try to download the necessary dependency as for docs.
So, as #laylakn pointed out (upvoted for that) there where an issue between repository mirroring between bintray and jcenter.
So, specifically to your problem, since you have told me that you have tried adding the libraries and synch without success, that's because the version of exoplayer you are looking for (r2.4.2) is in the spring plugin repository.
So you should add it as your maven repo (because of the mirroring error of repositories stated before):
maven {
url "https://repo.spring.io/plugins-release/"
}
Or as explain on main GitHub repo, just pointing directly to bintray.
maven {
url 'https://google.bintray.com/exoplayer/'
}
and you should synch your project adding this two libraries:
implementation 'com.google.android.exoplayer:exoplayer:r2.4.2'
implementation 'com.google.android.exoplayer:exoplayer-smoothstreaming:r2.4.4'
So now I'm glad to here from you that the mirroring problem has been resolved and are you able to sync right now, without doing any changes to your build.gradle files.
I've left and updated my answer to better explain this situation.
Also some other famous repo take precautions: [-:

Unable to resolve dependency for ':app#debug/compileClasspath': Could not resolve com.android.volley:volley:1.1.1

I tried to import android volley into my project, but it failed. I dont know what happened. This is the build.gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.root.wifi1"
minSdkVersion 22
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.constraint:constraint-layout:1.1.3'
implementation 'com.android.volley:volley:1.1.1'
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'
}
And this is the build.gradle for project:
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()
//maven { url "https://jitpack.io" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I have tried using volley library version 1.1.1, 1.1.0, the one from mcxiaoke, and a few other versions, but none of them worked. I also tried to switch my gradle version, and also tried to create local library using android volley that I cloned. Someone suggested to add maven { url "https://jitpack.io" } to allproject repositories, I also tried it, but it also didnt work. Of course I have also tried to disable offline gradle from Settings menu, but it didnt change anything.
this is the error :
Unable to resolve dependency for ':app#debug/compileClasspath': Could not resolve com.android.volley:volley:1.1.1.
Unable to resolve dependency for ':app#debugAndroidTest/compileClasspath': Could not resolve com.android.volley:volley:1.1.1.
Unable to resolve dependency for ':app#debugUnitTest/compileClasspath': Could not resolve com.android.volley:volley:1.1.1.
Unable to resolve dependency for ':app#release/compileClasspath': Could not resolve com.android.volley:volley:1.1.1.
Unable to resolve dependency for ':app#releaseUnitTest/compileClasspath': Could not resolve com.android.volley:volley:1.1.1.
Everytime I changed the volley version the error was just like that too.
I dont know what to do now, please help
PS: if i comment/remove the volley dependency my project works 100% fine, and I dont use a proxy-protected internet
Try to add this
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}}
To your build.gradle and then make a Clean project also Invalidate Cache & Restart from file options should work.

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.

Categories

Resources