1
votes

I wanted to change from SQLite to Room. But when I start a new project and implement the dependencies from https://developer.android.com/topic/libraries/architecture/adding-components#room I'm getting a sync failure. And I don't know why. I also inserted maven in repositories...

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()
        maven {
            // For Room Persistence Library
            url "https://maven.google.com"
        }
    }
}

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

build.gradle(Module)

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    defaultConfig {
        applicationId "com.example.beuttlerj.saveyourreceipt"
        minSdkVersion 23
        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:support-v4:26.1.0'
    implementation 'com.android.support:design: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 'org.jetbrains:annotations-java5:15.0'

    def room_version = "1.1.1"

    implementation "android.arch.persistence.room:runtime:$room_version"
    annotationProcessor "android.arch.persistence.room:compiler:$room_version" // use kapt for Kotlin

    // optional - RxJava support for Room
    implementation "android.arch.persistence.room:rxjava2:$room_version"

    // optional - Guava support for Room, including Optional and ListenableFuture
    implementation "android.arch.persistence.room:guava:$room_version"

    // Test helpers
    testImplementation "android.arch.persistence.room:testing:$room_version"
}

Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve android.arch.persistence.room:runtime:1.1.1. Open File Show Details

Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve android.arch.persistence.room:rxjava2:1.1.1. Open File Show Details

Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve android.arch.persistence.room:guava:1.1.1. Open File Show Details

Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve android.arch.persistence.room:runtime:1.1.1. Open File Show Details

Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve android.arch.persistence.room:rxjava2:1.1.1. Open File Show Details

Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve android.arch.persistence.room:guava:1.1.1. Open File Show Details

Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not resolve android.arch.persistence.room:runtime:1.1.1. Open File Show Details

Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not resolve android.arch.persistence.room:rxjava2:1.1.1. Open File Show Details

Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not resolve android.arch.persistence.room:guava:1.1.1. Open File Show Details

Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not resolve android.arch.persistence.room:testing:1.1.1. Open File Show Details

Unable to resolve dependency for ':app@release/compileClasspath': Could not resolve android.arch.persistence.room:runtime:1.1.1. Open File Show Details

Unable to resolve dependency for ':app@release/compileClasspath': Could not resolve android.arch.persistence.room:rxjava2:1.1.1. Open File Show Details

Unable to resolve dependency for ':app@release/compileClasspath': Could not resolve android.arch.persistence.room:guava:1.1.1. Open File Show Details

Unable to resolve dependency for ':app@releaseUnitTest/compileClasspath': Could not resolve android.arch.persistence.room:runtime:1.1.1. Open File Show Details

Unable to resolve dependency for ':app@releaseUnitTest/compileClasspath': Could not resolve android.arch.persistence.room:rxjava2:1.1.1. Open File Show Details

Unable to resolve dependency for ':app@releaseUnitTest/compileClasspath': Could not resolve android.arch.persistence.room:guava:1.1.1. Open File Show Details

Unable to resolve dependency for ':app@releaseUnitTest/compileClasspath': Could not resolve android.arch.persistence.room:testing:1.1.1. Open File Show Details

1

1 Answers

0
votes

Either you have a slow internet connection or the room version is not working with you, this could happen frequently, try the version 1.0.1 and see.