Ragavendra vignesh
Ragavendra vignesh

Reputation: 203

Unable to add Firestore to my project

when i tried to add firestore to my project.it started to show me the dependency error.i tried to change the version of every firebase related to same version.it shows unable to download .jar files.some one help me to sort this out.i included maven url also there is no use....enter code here

i don't know how to add these jar files manually.is there any way to solve this problem.so that these files will download automatically.thanks in advance

Error:

app/build.gradle    
Unable to resolve dependency for ':app@debug/compileClasspath': Could not download grpc-core.jar (io.grpc:grpc-core:1.8.0)
<a href="openFile:C:/Users/Sarukesi/AndroidStudioProjects/Seminarbook/app/build.gradle">Open File</a><br><a href="Unable to resolve dependency for &#39;:app@debug/compileClasspath&#39;: Could not download grpc-core.jar (io.grpc:grpc-core:1.8.0)">Show Details</a>  
Unable to resolve dependency for ':app@debug/compileClasspath': Could not download okhttp.jar (com.squareup.okhttp:okhttp:2.7.2)
<a href="openFile:C:/Users/Sarukesi/AndroidStudioProjects/Seminarbook/app/build.gradle">Open File</a><br><a href="Unable to resolve dependency for &#39;:app@debug/compileClasspath&#39;: Could not download okhttp.jar (com.squareup.okhttp:okhttp:2.7.2)">Show Details</a>    
Unable to resolve dependency for ':app@debug/compileClasspath': Could not download protobuf-lite.jar (com.google.protobuf:protobuf-lite:3.0.1)
<a href="openFile:C:/Users/Sarukesi/AndroidStudioProjects/Seminarbook/app/build.gradle">Open File</a><br><a href="Unable to resolve dependency for &#39;:app@debug/compileClasspath&#39;: Could not download protobuf-lite.jar (com.google.protobuf:protobuf-lite:3.0.1)">Show Details</a>  
Unable to resolve dependency for ':app@debug/compileClasspath': Could not download guava.jar (com.google.guava:guava:19.0)
<a href="openFile:C:/Users/Sarukesi/AndroidStudioProjects/Seminarbook/app/build.gradle">Open File</a><br><a href="Unable to resolve dependency for &#39;:app@debug/compileClasspath&#39;: Could not download guava.jar (com.google.guava:guava:19.0)">Show Details</a>  
Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not download grpc-core.jar (io.grpc:grpc-core:1.8.0)
<a href="openFile:C:/Users/Sarukesi/AndroidStudioProjects/Seminarbook/app/build.gradle">Open File</a><br><a href="Unable to resolve dependency for &#39;:app@debugAndroidTest/compileClasspath&#39;: Could not download grpc-core.jar (io.grpc:grpc-core:1.8.0)">Show Details</a>   
Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not download okhttp.jar (com.squareup.okhttp:okhttp:2.7.2)
<a href="openFile:C:/Users/Sarukesi/AndroidStudioProjects/Seminarbook/app/build.gradle">Open File</a><br><a href="Unable to resolve dependency for &#39;:app@debugAndroidTest/compileClasspath&#39;: Could not download okhttp.jar (com.squareup.okhttp:okhttp:2.7.2)">Show Details</a> 
Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not download protobuf-lite.jar (com.google.protobuf:protobuf-lite:3.0.1)
<a href="openFile:C:/Users/Sarukesi/AndroidStudioProjects/Seminarbook/app/build.gradle">Open File</a><br><a href="Unable to resolve dependency for &#39;:app@debugAndroidTest/compileClasspath&#39;: Could not download protobuf-lite.jar (com.google.protobuf:protobuf-lite:3.0.1)">Show Details</a>   
Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not download guava.jar (com.google.guava:guava:19.0)
<a href="openFile:C:/Users/Sarukesi/AndroidStudioProjects/Seminarbook/app/build.gradle">Open File</a><br><a href="Unable to resolve dependency for &#39;:app@debugAndroidTest/compileClasspath&#39;: Could not download guava.jar (com.google.guava:guava:19.0)">Show Details</a>   
Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not download grpc-core.jar (io.grpc:grpc-core:1.8.0)
<a href="openFile:C:/Users/Sarukesi/AndroidStudioProjects/Seminarbook/app/build.gradle">Open File</a><br><a href="Unable to resolve dependency for &#39;:app@debugUnitTest/compileClasspath&#39;: Could not download grpc-core.jar (io.grpc:grpc-core:1.8.0)">Show Details</a>  
Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not download okhttp.jar (com.squareup.okhttp:okhttp:2.7.2)
<a href="openFile:C:/Users/Sarukesi/AndroidStudioProjects/Seminarbook/app/build.gradle">Open File</a><br><a href="Unable to resolve dependency for &#39;:app@debugUnitTest/compileClasspath&#39;: Could not download okhttp.jar (com.squareup.okhttp:okhttp:2.7.2)">Show Details</a>    
Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not download protobuf-lite.jar (com.google.protobuf:protobuf-lite:3.0.1)
<a href="openFile:C:/Users/Sarukesi/AndroidStudioProjects/Seminarbook/app/build.gradle">Open File</a><br><a href="Unable to resolve dependency for &#39;:app@debugUnitTest/compileClasspath&#39;: Could not download protobuf-lite.jar (com.google.protobuf:protobuf-lite:3.0.1)">Show Details</a>  
Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not download guava.jar (com.google.guava:guava:19.0)
<a href="openFile:C:/Users/Sarukesi/AndroidStudioProjects/Seminarbook/app/build.gradle">Open File</a><br><a href="Unable to resolve dependency for &#39;:app@debugUnitTest/compileClasspath&#39;: Could not download guava.jar (com.google.guava:guava:19.0)">Show Details</a>  
Unable to resolve dependency for ':app@release/compileClasspath': Could not download grpc-core.jar (io.grpc:grpc-core:1.8.0)
<a href="openFile:C:/Users/Sarukesi/AndroidStudioProjects/Seminarbook/app/build.gradle">Open File</a><br><a href="Unable to resolve dependency for &#39;:app@release/compileClasspath&#39;: Could not download grpc-core.jar (io.grpc:grpc-core:1.8.0)">Show Details</a>    
Unable to resolve dependency for ':app@release/compileClasspath': Could not download okhttp.jar (com.squareup.okhttp:okhttp:2.7.2)
<a href="openFile:C:/Users/Sarukesi/AndroidStudioProjects/Seminarbook/app/build.gradle">Open File</a><br><a href="Unable to resolve dependency for &#39;:app@release/compileClasspath&#39;: Could not download okhttp.jar (com.squareup.okhttp:okhttp:2.7.2)">Show Details</a>  
Unable to resolve dependency for ':app@release/compileClasspath': Could not download protobuf-lite.jar (com.google.protobuf:protobuf-lite:3.0.1)
<a href="openFile:C:/Users/Sarukesi/AndroidStudioProjects/Seminarbook/app/build.gradle">Open File</a><br><a href="Unable to resolve dependency for &#39;:app@release/compileClasspath&#39;: Could not download protobuf-lite.jar (com.google.protobuf:protobuf-lite:3.0.1)">Show Details</a>    
Unable to resolve dependency for ':app@release/compileClasspath': Could not download guava.jar (com.google.guava:guava:19.0)
<a href="openFile:C:/Users/Sarukesi/AndroidStudioProjects/Seminarbook/app/build.gradle">Open File</a><br><a href="Unable to resolve dependency for &#39;:app@release/compileClasspath&#39;: Could not download guava.jar (com.google.guava:guava:19.0)">Show Details</a>    
Unable to resolve dependency for ':app@releaseUnitTest/compileClasspath': Could not download grpc-core.jar (io.grpc:grpc-core:1.8.0)
<a href="openFile:C:/Users/Sarukesi/AndroidStudioProjects/Seminarbook/app/build.gradle">Open File</a><br><a href="Unable to resolve dependency for &#39;:app@releaseUnitTest/compileClasspath&#39;: Could not download grpc-core.jar (io.grpc:grpc-core:1.8.0)">Show Details</a>    
Unable to resolve dependency for ':app@releaseUnitTest/compileClasspath': Could not download okhttp.jar (com.squareup.okhttp:okhttp:2.7.2)
<a href="openFile:C:/Users/Sarukesi/AndroidStudioProjects/Seminarbook/app/build.gradle">Open File</a><br><a href="Unable to resolve dependency for &#39;:app@releaseUnitTest/compileClasspath&#39;: Could not download okhttp.jar (com.squareup.okhttp:okhttp:2.7.2)">Show Details</a>  
Unable to resolve dependency for ':app@releaseUnitTest/compileClasspath': Could not download protobuf-lite.jar (com.google.protobuf:protobuf-lite:3.0.1)
<a href="openFile:C:/Users/Sarukesi/AndroidStudioProjects/Seminarbook/app/buil`d.gradle">Open File</a><br><a href="Unable to resolve dependency for &#39;:app@releaseUnitTest/compileClasspath&#39;: Could not download protobu`f-lite.jar (com.google.protobuf:protobuf-lite:3.0.1)">Show Details</a>  
Unable to resolve dependency for ':app@releaseUnitTest/compileClasspath': Could not download guava.jar (com.google.guava:guava:19.0)
<a href="openFile:C:/Users/Sarukesi/AndroidStudioProjects/Seminarbook/app/build.gradle">Open File</a><br><a href="Unable to resolve dependency for &#39;:app@releaseUnitTest/compileClasspath&#39;: Could not download guava.jar (com.google.guava:guava:19.0)">Show Details</a>    

Build.gradle:

//noinspection GradleDependency
apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.example.sarukesi.seminarbook"
        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(include: ['*.jar'], dir: 'libs')
    //noinspection GradleCompatible
    implementation 'com.android.support:appcompat-v7:28.0.0-alpha3'
    implementation 'com.android.support.constraint:constraint-layout:1.1.1'
    implementation 'com.google.firebase:firebase-core:16.0.1'
    implementation 'com.google.firebase:firebase-auth:16.0.1'
    implementation 'junit:junit:4.12'
    implementation 'com.android.support.test:runner:1.0.2'
    implementation 'com.android.support.test.espresso:espresso-core:3.0.2'

    implementation 'com.google.firebase:firebase-firestore:17.0.1'
}

apply plugin: 'com.google.gms.google-services'

Upvotes: 2

Views: 3307

Answers (3)

Vengatesh Murugasamy
Vengatesh Murugasamy

Reputation: 351

I have added mavenCentral() to project level build.gradle file. Gradle sync succeeded.

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        google()
        jcenter()
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.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 {
        google()
        jcenter()
        mavenCentral()    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

Upvotes: 7

Ragavendra vignesh
Ragavendra vignesh

Reputation: 203

I tried to downgrade the appcompat version from 28 to 15.but the error remains same.so i again changed that to 28 and deleted that maven url from build.gradle file because i read somewhere if google() is present that is enough so i deleted that.after that those dependency errors are automatically resolved.and finally gradle was successfully build.thanks @giudigior and @AlexMamo for replying....

Upvotes: 0

giudigior
giudigior

Reputation: 146

Make sure you're in your project

Open the Preferences, by clicking

  • File > Settings (on Mac, Android Studio > Preferences)
  • In the left pane, click Build, Execution, Deployment >> Gradle
  • Uncheck/disable the Offline work checkbox
  • Click Apply or OK

Upvotes: 0

Related Questions