我只是在我的项目中添加具有默认设置的Master/Detail活动,并得到以下错误:
**无法解决‘:app@调试器-api测试/编译器-compileClasspath’的依赖关系:无法解析javax.批注:javax.批注-api:1.2。无法解析javax.批注:javax.批注-api:1.2。所需: project :app > com.android.support.test.espresso:espresso-core:2.2.2
没有缓存版本的javax.批注:javax.批注-api:1.2可用于脱机模式。**
这是我的build.gradle:app
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.fasttrack.marileena.masterdetailapplication"
minSdkVersion 20
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:recyclerview-v7:26.1.0'
implementation 'com.android.support:design:26.1.0'
testImplementation 'junit:junit:4.12'
/*androidTestImplementation 'com.android.support.test:runner:0.5'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:2.2.2'*/
}在对最后两个依赖项进行注释之后,错误将被删除。删除它们可以吗?这样做还会有进一步的问题吗?
发布于 2018-01-23 08:55:12
虽然删除此依赖项没有实际问题,但可以修复禁用脱机工作选项的编译。转到Preferences > Build、Execution、Deployment > Gradle,并取消选中“脱机工作”选项。那就再来一次。
https://stackoverflow.com/questions/48397441
复制相似问题