【问题标题】:Design editor is Unavailable Until after successful project sync设计编辑器在项目同步成功之前不可用
【发布时间】:2020-09-11 16:12:40
【问题描述】:

我是 Android 新手,当我尝试在设计编辑器中为第一个应用程序设计 UI 时,我遇到了一个错误“设计编辑器在项目同步成功之前不可用”,然后我意识到我在同步面板中也遇到了问题,并且以上就是build.gradle 中的依赖关系。我应该如何更改依赖项来解决这个问题?以下是build.gradle 中的依赖项:

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])

    implementation 'androidx.appcompat:appcompat:1.0.2'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test.ext:junit:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
}

以下是同步错误:

ERROR:Failed to resolve:junit
ERROR:Failed to resolve:epresso-idling-source
ERROR:Failed to resolve:runner
ERROR:Failed to resolve:core
ERROR:Failed to resolve:epresso-core
ERROR:Failed to resolve:monitor

【问题讨论】:

  • 编辑您的问题并添加您在同步 Gradle 时遇到的错误。
  • 当我尝试同步 gradle 时出现以下错误:错误:无法解析:Runner,,Core,,espresso-core,, monitor
  • 应该是别的东西,我复制了你的依赖,没有报错
  • 感谢您投入时间。testimplemenatation 部分导致了这个问题,通过删除包括它们在内的三行我可以解决问题,但我不知道为什么会发生这种情况。

标签: java android android-studio build.gradle


【解决方案1】:

我刚刚从依赖项中删除了以下这些行,它起作用了,

testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'

但我不知道这是否会在未来引起问题..

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-02-14
    • 1970-01-01
    • 2020-03-08
    • 2018-07-21
    • 1970-01-01
    相关资源
    最近更新 更多