首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Android 0.8.1 Robolectric安装程序

Android 0.8.1 Robolectric安装程序
EN

Stack Overflow用户
提问于 2014-07-02 21:03:21
回答 1查看 2.5K关注 0票数 1

我正试图让新的安卓0.8.1的频闪工作,因为目前没有节拍级0.12插件,所以我希望.11将在目前工作。

*问题:

androidTestCompile‘org.robolecture:robolectric:2.3’

使用下面的声明编译robolectric,我无法在我的测试目录中找到“org.robolectur.*”,studio给出“无法解析符号.”错误。

根据以下项目,您必须手动更新iml文件。这可能不是最好的解决方案,因为更新gradle文件会覆盖您所做的任何更改。

希望能在这件事上提供帮助!!谢谢。

*目前的项目结构是:

代码语言:javascript
复制
   src -> main -> java

   src -> test -> java

*下面是我当前的build.gradle模块文件:

代码语言:javascript
复制
apply plugin: 'android-library'
apply plugin: 'robolectric'


buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.12.+'
        classpath 'org.robolectric:robolectric-gradle-plugin:0.11.+'
    }
}

allprojects {
    repositories {
       jcenter()
    }
}

android {
    compileSdkVersion 16
    buildToolsVersion '19.1.0'
    publishNonDefault true

    packagingOptions {
        exclude 'LICENSE.txt'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE'
    }

    defaultConfig {
        applicationId 'com.myapp.example.main'
        minSdkVersion 14
        targetSdkVersion 19
        versionCode 1
        versionName '1.0'

    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    productFlavors {
    }
    sourceSets {
        androidTest {
            setRoot('src/test/java')
        }
    }
    lintOptions {
        abortOnError false
        disable 'InvalidPackage'
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:+'
    compile files('libs/gson-2.2.4.jar')
    compile 'com.google.android.gms:play-services:+'
    compile 'com.android.support:support-v13:+'

    /* Including testing libraries */
    androidTestCompile 'junit:junit:4.10'
    androidTestCompile 'org.robolectric:robolectric:2.3'
}

robolectric {
    // configure the set of classes for JUnit tests
    include '**/*Test.class'

    // configure max heap size of the test JVM
    maxHeapSize = "2048m"
}
EN

回答 1

Stack Overflow用户

发布于 2015-04-15 00:05:43

现在有点晚了。但是我也遇到了这个错误,结果我的依赖项中的Robolectric版本已经过时了。在我用最新发现的这里替换了它之后,我修正了错误。此外,您可以将androidTestCompile更改为testCompile,因为您在这里编写单元测试。你可以找到两个这里之间的区别

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/24540980

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档