无法解析类型 com.google.android.apps。在编辑调试配置时
Cannot resolve type com.google.android.apps. while editing Debug Configurations
我正在尝试在我的 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 {
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"无法解析。
我错过了什么?
从 Espresso 2.0 开始,您需要使用 android.support.test.runner.AndroidJUnitRunner
作为默认跑步者
可以找到设置说明here
我正在尝试在我的 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 {
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"无法解析。
我错过了什么?
从 Espresso 2.0 开始,您需要使用 android.support.test.runner.AndroidJUnitRunner
作为默认跑步者
可以找到设置说明here