Android Studio Gradle - Unable to solve dependency - android

I'm getting the following errors when trying to add implementation 'com.android.support:cardview-v7:27.1.1' to my build.gradle (app):
Unable to resolve dependency for ':app#debug/compileClasspath': Could not
resolve com.android.support:cardview-v7:27.1.1.
Unable to resolve dependency for ':app#debugAndroidTest/compileClasspath':
Could not resolve com.android.support:cardview-v7:27.1.1.
Unable to resolve dependency for ':app#debugUnitTest/compileClasspath':
Could not resolve com.android.support:cardview-v7:27.1.1.
Unable to resolve dependency for ':app#release/compileClasspath': Could not
resolve com.android.support:cardview-v7:27.1.1.
Unable to resolve dependency for ':app#releaseUnitTest/compileClasspath':
Could not resolve com.android.support:cardview-v7:27.1.1.
Here is my App gradle:
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 27
defaultConfig {
applicationId "afinal.recipe.p.recipe1"
minSdkVersion 22
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(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:support-media-compat:27.1.1'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.android.support:design:27.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'
implementation 'com.google.firebase:firebase-auth:16.0.1'
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.google.firebase:firebase-storage:16.0.1'
implementation 'com.google.firebase:firebase-auth:16.0.1'
implementation 'com.google.firebase:firebase-database:16.0.1'
implementation 'com.github.bumptech.glide:glide:4.8.0'
implementation 'de.hdodenhof:circleimageview:3.0.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0'
implementation 'com.android.support:recyclerview-v7:27.1.1'
implementation 'com.android.support:cardview-v7:27.1.1'
}
apply plugin: 'com.google.gms.google-services'
And my Project 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.2.1'
classpath 'com.google.gms:google-services:4.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"
}
mavenCentral()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I've already been stuck on this for a while and tried a variety of solutions with no success such as ensuring offline mode isn't checked and changing
apply plugin: 'com.android.application'
to:
apply plugin: 'com.android.library'
and, without success, deleting:
applicationId "afinal.recipe.p.recipe1"
Thanks in advance for any help, would be greatly appreciated.

Related

Unable to resolve these errors?

/*These are the errors occurring while building the project any help regarding it to resolve it thanks.
Add while building project it take to much time and after downloading these errors are showing */
ERROR: Unable to resolve dependency for ':app#debug/compileClasspath': Could not resolve androidx.multidex:multidex:2.0.0.
ERROR: Unable to resolve dependency for ':app#debugAndroidTest/compileClasspath': Could not resolve androidx.multidex:multidex-instrumentation:2.0.0.
ERROR: Unable to resolve dependency for ':app#debugAndroidTest/compileClasspath': Could not resolve androidx.multidex:multidex:2.0.0.
ERROR: Unable to resolve dependency for ':app#debugUnitTest/compileClasspath': Could not resolve androidx.multidex:multidex:2.0.0.
Build.gradle(App)
apply plugin: 'com.android.application'
android {
compileSdkVersion 29
buildToolsVersion "29.0.0"
defaultConfig {
applicationId "com.sherry.fitnessapp"
minSdkVersion 16
targetSdkVersion 29
multiDexEnabled true
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.google.firebase:firebase-analytics:17.2.0'
implementation 'com.google.firebase:firebase-auth:19.1.0'
implementation 'com.google.firebase:firebase-firestore:21.1.1'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.google.android.material:material:1.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
apply plugin: 'com.google.gms.google-services'
Build.gradle(project level)
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
maven { url 'https://dl.bintray.com/android/android-tools' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.1'
classpath 'com.google.gms:google-services:4.3.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
}
/* these above are the files of dependencies i just put these and these error are occurring thankful your help and sorry to not and fully details if not described the question properly*/
I just rebuild the project ad these errors resolved, It's fun, And the Internet should also connected... :P

Unable to resolve dependency for ':app#debug/compileClasspath':Could not resolve project :PGSDKVR4.AggrePay-android

This is my gradle file :
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
android {
compileSdkVersion 26
defaultConfig {
applicationId "apps.com.athulyacustomer"
minSdkVersion 19
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation project(":PGSDKVR4")
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.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'
implementation 'com.android.support:cardview-v7:26.1.0'
implementation 'com.android.support:recyclerview-v7:26.1.0'
implementation 'com.android.support:design:26.1.0'
implementation 'com.mcxiaoke.volley:library:1.0.19'
implementation 'com.weiwangcn.betterspinner:library-material:1.1.0'
implementation 'com.github.nipun-birla:BoxLoaderView:0.0.1'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.weiwangcn.betterspinner:library-material:1.1.0'
implementation('com.crashlytics.sdk.android:crashlytics:2.6.8#aar') {
transitive = true;
}
}
repositories {
maven { url "https://jitpack.io" }
maven { url 'https://maven.fabric.io/public' }
}
Getting the below mentioned error after syncing the gradle with the project folder.
ERROR: Unable to resolve dependency for ':app#debug/compileClasspath': Could not resolve project :PGSDKVR4.
ERROR: Unable to resolve dependency for ':app#debugAndroidTest/compileClasspath': Could not resolve project :PGSDKVR4.
Have added the plugin according to the documentation and sample app present on the below mentioned links.
https://github.com/paymentgatewayintegration/sampleapp
Please do let me know how can i can find a solution to this error.
Awaiting for your replies.
update dependencies in your projects build.gradle file
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
classpath 'com.google.gms:google-services:3.2.1'
}

Problem with the Gradle files. I have already connected the project to Firebase and now I am trying to add Google map

My project is connected to Firebase (Database) and now I am tring to add Google map. When I add one of the dependencies I get an error message while the sync.
It says something about using different version etc.
HELP !!
Description:
After I added this line to the app gradle file:
implementation 'com.google.android.gms:play-services-maps:16.0.0'
I got this error:
The library com.google.android.gms:play-services-base is being requested by various other libraries at [[15.0.1,15.0.1]], but resolves to 16.0.1. Disable the plugin and check your dependencies tree using ./gradlew :app:dependencies.
with out the line that I have added everything is fine.
app gradle code:
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.rotem.bepart_appproject"
minSdkVersion 23
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(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 'com.google.firebase:firebase-auth:16.0.1'
implementation 'com.google.firebase:firebase-database:16.0.1'
implementation 'com.android.support:design:28.0.0'
implementation 'com.google.firebase:firebase-storage:16.0.1'
implementation 'com.google.firebase:firebase-core:16.0.1'
**implementation 'com.google.android.gms:play-services-maps:16.0.0'**
}
my project gradle 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.2.1'
classpath 'com.google.gms:google-services:4.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
}
To solve this, please change the following lines of code:
implementation 'com.google.firebase:firebase-auth:16.0.1'
implementation 'com.google.firebase:firebase-database:16.0.1'
implementation 'com.google.firebase:firebase-storage:16.0.1'
implementation 'com.google.firebase:firebase-core:16.0.1'
**implementation 'com.google.android.gms:play-services-maps:16.0.0'**
to
implementation 'com.google.firebase:firebase-auth:16.1.0'
implementation 'com.google.firebase:firebase-database:16.0.5'
implementation 'com.google.firebase:firebase-storage:16.0.5'
implementation 'com.google.firebase:firebase-core:16.0.6'
implementation 'com.google.android.gms:play-services-maps:16.0.0'
Keeping the same version for all Firebase dependencies is now anti-pattern.

Unable to resolve dependency for retrofit2

I try to import a retrofit library to my gradle file but unfortunately, I am facing too many errors.
Unable to resolve dependency for ':app#debug/compileClasspath': Could not resolve com.squareup.retrofit2:retrofit:2.4.0.
Unable to resolve dependency for ':app#debugAndroidTest/compileClasspath': Could not resolve com.squareup.retrofit2:retrofit:2.4.0.
Unable to resolve dependency for ':app#debugUnitTest/compileClasspath': Could not resolve com.squareup.retrofit2:retrofit:2.4.0.
Unable to resolve dependency for ':app#release/compileClasspath': Could not resolve com.squareup.retrofit2:retrofit:2.4.0.
Unable to resolve dependency for ':app#releaseUnitTest/compileClasspath': Could not resolve com.squareup.retrofit2:retrofit:2.4.0.
EDIT
This is my app build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.example.practice"
minSdkVersion 19
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'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
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.3'
implementation 'com.android.support:design:27.1.1'
implementation 'com.dinuscxj:recyclerrefreshlayout:2.0.5'
implementation 'com.makeramen:roundedimageview:2.3.0'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.aurelhubert:ahbottomnavigation:2.1.0'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.google.firebase:firebase-database:16.0.1'
implementation 'com.google.firebase:firebase-auth:16.0.3'
implementation 'com.google.firebase:firebase-storage:16.0.1'
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.firebaseui:firebase-ui-database:4.1.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.jakewharton:butterknife:8.8.1'
implementation 'com.jakewharton.timber:timber:4.7.1'
implementation 'com.squareup.picasso:picasso:2.71828'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
implementation 'id.zelory:compressor:2.1.0'
implementation 'com.vanniktech:emoji-one:0.5.1'
implementation 'net.danlew:android.joda:2.9.9.3'
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
}
apply plugin: 'com.google.gms.google-services'
This is my project build.gradle
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
classpath 'com.google.gms:google-services:4.0.1'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I added the latest version of the retrofit2 but still get these errors. I have search for possible solutions but I can't find anything. Can someone help me with this problem?
Can you add this plugins are your app build.gradle file
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
implementation 'com.google.code.gson:gson:2.8.2'
implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
implementation 'com.squareup.okhttp3:logging-interceptor:3.4.1'
implementation 'com.squareup.okhttp3:okhttp:3.10.0'
And Can u change project build.gradle file like below code in allprojects
allprojects {
repositories {
google()
maven { url "https://jitpack.io" }
jcenter()
} }
Try this
implementation('com.squareup.retrofit2:retrofit:2.1.0') {
// exclude Retrofit’s OkHttp dependency module and define your own module import
exclude module: 'okhttp'
}
implementation 'com.google.code.gson:gson:2.8.2'
implementation 'com.squareup.retrofit2:converter-gson:2.1.0'
implementation 'com.squareup.okhttp3:logging-interceptor:3.4.1'
implementation 'com.squareup.okhttp3:okhttp:3.4.1'
and project build.gradle
allprojects {
repositories {
jcenter()
google()
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
Add your build Gradle file
'com.squareup.retrofit2:retrofit:2.4.0'
Try adding this to the module (i.e. app) level gradle:
repositories {
maven {
mavenCentral()
}
}
Also you can try:
Go to File/Invalidate Cache-Restart
I have found a solution. I forgot to uncheck the offline work in Settings -> Build, Execution, Deployment -> Gradle -> Offline Work

Grable build fails while enabling data binding to the project

I'm trying to use databinding for my app but gradle build fails. I'm not able to resolve this. Need your help.
Error i'm facing
Unable to resolve dependency for ':app#debug/compileClasspath': Could not resolve com.android.databinding:library:3.1.0.
Unable to resolve dependency for ':app#debug/compileClasspath': Could not resolve com.android.databinding:adapters:3.1.0.
Unable to resolve dependency for ':app#debugAndroidTest/compileClasspath': Could not resolve com.android.databinding:library:3.1.0.
app level gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.example.dell.pitchpls"
minSdkVersion 21
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'
}
}
buildToolsVersion '27.0.3'
dataBinding{
enabled = true
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:design:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation 'com.android.support:support-v4:26.1.0'
implementation 'com.android.support:cardview-v7:26.1.0'
implementation 'com.google.firebase:firebase-auth:16.0.1'
implementation 'com.google.firebase:firebase-database:16.0.1'
implementation 'com.google.firebase:firebase-storage:16.0.1'
implementation 'com.firebaseui:firebase-ui-database:3.0.0'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.squareup.okhttp:okhttp:2.5.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'
}
apply plugin: 'com.google.gms.google-services'
Project level gradle file
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.0'
classpath 'com.google.gms:google-services:4.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
}

Categories

Resources