无法解决:核心受影响的模块:应用程序

问题描述 投票:0回答:1

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

我添加

compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

在madule:app中的android标签中。

并且还添加了黄油刀相关性:

implementation 'com.jakewharton:butterknife:10.2.1'
  annotationProcessor 'com.jakewharton:butterknife-compiler:10.2.1'
} 

就像[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

java android android-studio gradle butterknife
1个回答
0
投票

[尝试从'Project Structure'->'Dependencies'->'Libraries'添加butterKnife依赖性,您可以在其中轻松地'Google'搜索ButterKnife。也可以随时尝试那里的更新建议。

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

如果您可以发布gradle文件,可能会有所帮助。

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

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

© www.soinside.com 2019 - 2024. All rights reserved.