java - 无法解析 : core Affected Modules: app

标签 java android android-studio gradle butterknife

我正在使用 Android Studio 3.5.3 ,我的 Gradle 版本是 5.4.1 。
添加后 butterknife 我的项目不同步,它显示错误“无法解决:核心”。

我加了

compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

在 madule:app 的 android 标签中。

并添加了 butterknife 依赖项:
implementation 'com.jakewharton:butterknife:10.2.1'
  annotationProcessor 'com.jakewharton:butterknife-compiler:10.2.1'
} 

就像 butterknife 在 https://github.com/JakeWharton/butterknife 中的步骤一样

我的 build.gradle(module:app)
apply plugin: 'com.android.application'
apply plugin: 'com.jakewharton.butterknife'


android {
    compileSdkVersion 29
    buildToolsVersion "29.0.2"
    defaultConfig {
        applicationId "com.example.myapplication"
        minSdkVersion 15
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        multiDexEnabled true

    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation  'androidx.legacy:legacy-support-v4:1.0.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.2.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
    implementation 'com.android.support:multidex:1.0.3'
    implementation 'com.jakewharton:butterknife:10.2.1'
    annotationProcessor 'com.jakewharton:butterknife-compiler:10.2.1'


}
repositories {
    mavenCentral()
}

我的 build.gradle(项目:我的应用程序)
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        google()
        mavenCentral()      
        jcenter()


    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.5.3'
        classpath 'com.jakewharton:butterknife-gradle-plugin:10.2.1'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
        mavenCentral()
        google()
       maven { url "https://jitpack.io" }
        maven { url "https://maven.google.com"}
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

这是我的错误代码
ERROR: Failed to resolve: core
Affected Modules: app

my error code

最佳答案

尝试从 'Project Structure'-->'Dependencies'-->'Libraries' 添加 butterKnife 依赖项,您可以轻松地在 ButterKnife 上进行 'Google' 搜索。也可以随意尝试那里的更新建议。

也检查其他库。尝试通过注释来禁用依赖项,直到遇到问题。它是命中和审判的方法,因为事情是不确定的。

如果您可以发布您的 gradle 文件,可能会为您提供帮助。

您可以尝试使缓存失效并让我们知道它是否有效。

怀疑是有一个名为 core 的模块被删除了。可能有任何称为核心的符号,并且没有任何 IDE 能够识别的定义。

关于java - 无法解析 : core Affected Modules: app,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59544214/

相关文章:

java - 使用 intellij-idea 在 Windows 上的 tomcat 启动问题

java - Groovy 类使用另一个实例字段

java - 如何获取驻留在 src/main/resources 中的 .exe 文件的路径

java - 安卓 P : Service behavior changes

android - 使用 ProGuard 和 Android 应用程序时出现重复资源

java - Android如何按顺序为对象设置动画

android - 在 Skobbler 中完成导航时确定 "side of street"的最佳方法是什么?

android-studio - Android Studio-支持存储库安装错误

android - 无法在 Android Studio 中解析 R,但应用编译正常

android - 无法完成 Gradle 执行,因为只允许从事件分派(dispatch)线程进行写入访问