android - 错误=> 无法确定任务 ':app:compileDebugJavaWithJavac' 的依赖关系

标签 android android-studio

当我在 Android Studio 中执行 Android 应用程序时遇到问题,它显示错误,如下所述。我该如何解决这个问题?

Error:Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'. Could not create service of type AnnotationProcessorDetector using JavaGradleScopeServices.createAnnotationProcessorDetector().

构建.gradle:

apply plugin: 'com.android.application'
android {
    compileSdkVersion 26
    defaultConfig {
        applicationId "com.example.toshiba.bluetooth_deneme"
        minSdkVersion 15
        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.constraint:constraint-layout:1.0.2'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
    compile 'com.android.support:support-annotations:27.0.2'
}

最佳答案

我遇到了类似的问题,结果我的项目需要重新同步。单击下面的按钮为我修复了它。 (但我无法说出为什么会发生这种情况。)

Sync Project Button

关于android - 错误=> 无法确定任务 ':app:compileDebugJavaWithJavac' 的依赖关系,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48139332/

相关文章:

android - 我如何在 Android Studio 中运行调试器并设置断点?

android - 在构建 android 源后制作 sdk 时 Make 失败

android - 仅在构建.apk时出现错误

java - Google Glass 全屏自定义布局卡

android - 应用程序 :compileFlutterBuildRelease error while building app flutter

java - AppWidgetProvider 的 Android M 权限

android - 未处理的异常 : Android. Views.InflateException:二进制 XML 文件行 #1:二进制 XML 文件行 #1:类 fragment 膨胀时出错

java - Android 64k 方法在 56k 方法上限制错误

android - Gradle - 无法创建工具 API 实现的实例

android - Proguard : can't find referenced method 'android. app.DatePickerDialog 访问$000