找不到与org.robolectric匹配的任何版本:robolectric:2.3。+

时间:2014-07-11 23:58:15

标签: android maven gradle robolectric

在Android Studio中同步我的Gradle项目时,出现以下错误:

  

错误:找不到与org.robolectric匹配的任何版本:robolectric:2.3。+。   要求:       的gradle:机器人:未指定的

我假设我在build.gradle文件中缺少一个存储库。我是Gradle和Maven的新手,所以我不确定应该放什么。有什么建议吗?

以下是我的build.gradle文件:

项目:

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.12.+'
        classpath 'com.github.jcandksolutions.gradle:android-unit-test:1.2.+'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        mavenCentral()
    }
}

模块:

apply plugin: 'android'

android {
    compileSdkVersion 19
    buildToolsVersion "19.1.0"

    defaultConfig {
        applicationId "bbct.android.common"
        minSdkVersion 11
        targetSdkVersion 19
        versionCode 1
        versionName "1.0"
    }
    signingConfigs {
        release
    }
    buildTypes {
        release {
            signingConfig signingConfigs.release
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    productFlavors {
        lite {
            applicationId "bbct.android"
            versionCode 15
            versionName "0.6.2"
        }
        premium {
            applicationId "bbct.android.premium"
            versionCode 14
            versionName "0.6.2"
        }
    }
    def Properties props = new Properties()
    def propFile = new File('signing.properties')
    if (propFile.canRead()) {
        props.load(new FileInputStream(propFile))

        if (props!=null && props.containsKey('STORE_FILE') && props.containsKey('STORE_PASSWORD') &&
                props.containsKey('KEY_ALIAS') && props.containsKey('KEY_PASSWORD')) {
            android.signingConfigs.release.storeFile = file(props['STORE_FILE'])
            android.signingConfigs.release.storePassword = props['STORE_PASSWORD']
            android.signingConfigs.release.keyAlias = props['KEY_ALIAS']
            android.signingConfigs.release.keyPassword = props['KEY_PASSWORD']
        } else {
            println 'signing.properties found but some entries are missing'
            android.buildTypes.release.signingConfig = null
        }
    } else {
        println 'signing.properties not found'
        android.buildTypes.release.signingConfig = null
    }
}

apply plugin: 'android-unit-test'

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:19.1.0'
    compile 'com.android.support:support-v4:19.1.0'
    compile 'com.google.android.gms:play-services:4.2.42'
    liteCompile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile 'com.jayway.android.robotium:robotium-solo:5.1'
    androidTestCompile ('com.squareup:fest-android:1.0.8') {
        exclude group: 'com.android.support'
    }
    testCompile 'junit:junit:4.10'
    testCompile 'org.robolectric:robolectric:2.3.+'
}

1 个答案:

答案 0 :(得分:3)

正如我在评论中所说,尝试删除加号。从技术上讲,它不应该有所作为(因此我不愿意将其作为答案发布),但正如我所说,我很确定这在过去曾经发生在我身上。

我很高兴它解决了你的问题。 :)