首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >在AndroidStudio3.0中添加主/详细活动会引发错误

在AndroidStudio3.0中添加主/详细活动会引发错误
EN

Stack Overflow用户
提问于 2018-01-23 08:46:00
回答 1查看 166关注 0票数 0

我只是在我的项目中添加具有默认设置的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

代码语言:javascript
运行
复制
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'*/
}

在对最后两个依赖项进行注释之后,错误将被删除。删除它们可以吗?这样做还会有进一步的问题吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-01-23 08:55:12

虽然删除此依赖项没有实际问题,但可以修复禁用脱机工作选项的编译。转到Preferences > Build、Execution、Deployment > Gradle,并取消选中“脱机工作”选项。那就再来一次。

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

https://stackoverflow.com/questions/48397441

复制
相关文章

相似问题

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