【问题标题】:Cannot resolve type com.google.android.apps. while editing Debug Configurations无法解析类型 com.google.android.apps。在编辑调试配置时
【发布时间】:2015-07-06 22:19:49
【问题描述】:

我正在尝试在我的 android 应用程序中使用 Espresso 配置仪器测试,遵循this 问题,因为运行测试时出现空指针异常。

其实我的 build.gradle 依赖部分是这样的:

dependencies {
    compile files('libs/pixlui-1-0-5.jar')
    // You must install or update the Support Repository through the SDK manager to use this dependency.
    compile('com.fortysevendeg.swipelistview:swipelistview:1.0-SNAPSHOT@aar') {
        transitive = true
    }
    //compile 'com.google.code.gson:gson:2.2.4'
    compile 'com.google.code.gson:gson:2.3'
    compile 'com.android.support:appcompat-v7:20.+'
    compile 'com.google.android.gms:play-services-maps:7.3.0'
    compile 'com.google.android.gms:play-services-location:7.3.0'
    compile 'com.google.android.gms:play-services-gcm:7.3.0'

    compile 'com.loopj.android:android-async-http:1.4.5'
    // You must install or update the Support Repository through the SDK manager to use this dependency.
    compile 'com.android.support:support-v4:20.+'
    compile ('ch.acra:acra:4.5.0'){
        exclude group: 'org.json'
    }
    compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.2'
    compile 'com.squareup.picasso:picasso:2.3.4'
    provided 'com.squareup.dagger:dagger-compiler:1.2.+'
    compile 'com.squareup.dagger:dagger:1.2.+'
    compile 'com.google.guava:guava:15.0'
    //compile 'com.facebook.android:facebook-android-sdk:3.23.0'
    compile 'com.mixpanel.android:mixpanel-android:4.5.3'
    compile 'com.google.maps.android:android-maps-utils:0.3+'

    // Testing dependencies
    testCompile "junit:junit:4.5+"
    testCompile "org.mockito:mockito-core:1.9.5"

    androidTestCompile 'com.android.support.test.espresso:espresso-core:2.0'
    androidTestCompile 'com.android.support.test:testing-support-lib:0.1'
    androidTestCompile ('com.android.support.test.espresso:espresso-contrib:2.0') {
        exclude module: 'support-annotations'
    }
}

还有 defaultConfig 部分:

defaultConfig {
        applicationId 'com.blabla.easyaccess'
        minSdkVersion 14
        targetSdkVersion 19
        testInstrumentationRunner "com.google.android.apps.common.testing.testrunner.GoogleInstrumentationTestRunner"

    }

我读到我不需要修改 android.manifest,因为它是为 IntrumentalTests 自动生成的。

但是当我编辑调试配置“com.google.android.apps.common.testing.testrunner.GoogleInstrumentationTestRunner”时无法解决。

我错过了什么?

【问题讨论】:

    标签: android android-gradle-plugin android-espresso


    【解决方案1】:

    从 Espresso 2.0 开始,您需要使用 android.support.test.runner.AndroidJUnitRunner 作为默认跑步者

    设置说明见here

    【讨论】:

    • 完成设置说明并运行 conf.它抛出了一个新异常:错误:任务':app:dexFullDebugAndroidTest'的执行失败。 > com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_31\bin\java.exe'' 没有完成-zero 退出值 2 你知道吗?它没有提供更多信息。
    猜你喜欢
    • 1970-01-01
    • 2017-04-23
    • 2012-11-19
    • 2012-07-09
    • 1970-01-01
    • 1970-01-01
    • 2011-12-10
    • 2019-09-12
    • 2012-09-12
    相关资源
    最近更新 更多