【问题标题】:Android Studio can't find com.jakewharton:butterknife-compiler:5.1.2Android Studio 找不到 com.jakewharton:butterknife-compiler:5.1.2
【发布时间】:2019-04-11 06:11:15
【问题描述】:

我正在尝试构建我的 Android 项目,但是当我重新构建时收到以下错误消息:

找不到 com.jakewharton:butterknife-compiler:5.1.2。 在以下位置搜索: 文件:/C:/Android/android-sdk/extras/m2repository/com/jakewharton/butterknife-compiler/5.1.2/butterknife-compiler-5.1.2.pom

文件:/C:/Android/android-sdk/extras/m2repository/com/jakewharton/butterknife-compiler/5.1.2/butterknife-compiler-5.1.2.jar 文件:/C:/Android/android-sdk/extras/google/m2repository/com/jakewharton/butterknife-compiler/5.1.2/butterknife-compiler-5.1.2.pom 文件:/C:/Android/android-sdk/extras/google/m2repository/com/jakewharton/butterknife-compiler/5.1.2/butterknife-compiler-5.1.2.jar 文件:/C:/Android/android-sdk/extras/android/m2repository/com/jakewharton/butterknife-compiler/5.1.2/butterknife-compiler-5.1.2.pom 文件:/C:/Android/android-sdk/extras/android/m2repository/com/jakewharton/butterknife-compiler/5.1.2/butterknife-compiler-5.1.2.jar https://jcenter.bintray.com/com/jakewharton/butterknife-compiler/5.1.2/butterknife-compiler-5.1.2.pom https://jcenter.bintray.com/com/jakewharton/butterknife-compiler/5.1.2/butterknife-compiler-5.1.2.jar https://dl.google.com/dl/android/maven2/com/jakewharton/butterknife-compiler/5.1.2/butterknife-compiler-5.1.2.pom https://dl.google.com/dl/android/maven2/com/jakewharton/butterknife-compiler/5.1.2/butterknife-compiler-5.1.2.jar 要求: 项目:应用程序

这是我的 build.gradle 模块:

apply plugin: 'com.android.application'

android {
compileSdkVersion 26
buildToolsVersion '28.0.3'
defaultConfig {
    applicationId "com.wakeup.xxx"
    minSdkVersion 18
    targetSdkVersion 25
    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(include: ['*.jar'], dir: 'libs')
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
})
implementation 'com.android.support:appcompat-v7:25.1.1'
testImplementation 'junit:junit:4.12'
implementation 'com.jjoe64:graphview:4.2.2'
implementation 'com.jakewharton:butterknife:5.1.2'
annotationProcessor 'com.jakewharton:butterknife-compiler:5.1.2'


// https://mvnrepository.com/artifact/com.jakewharton/butterknife
}

buildscript {
repositories {
    google() // <--here
}
}

allprojects {
repositories {
    google() // <-- here
}
 }

有人可以帮我吗?

【问题讨论】:

  • 您的项目:app 缺少黄油刀参考。当您忘记正确定义模块依赖项时,通常会发生这种情况。请发布您的build.gradle 文件。
  • 刚刚添加了坦克

标签: android android-studio jar


【解决方案1】:

您的项目:app 缺少黄油刀参考。从documentation,这就是您所缺少的:

repositories {
    mavenCentral()
}

另外,你使用的版本5.1.2不存在:

{ “错误” : [ { “状态”:404, “消息”:“找不到资源”}]}

试试下面的文件:

apply plugin: 'com.android.application'

buildscript {
    repositories {
        google()
        mavenCentral()
    }
}

allprojects {
    repositories {
        google()
        mavenCentral()
    }
}

android {
    compileSdkVersion 26
    buildToolsVersion '28.0.3'

    defaultConfig {
        applicationId "com.wakeup.xxx"
        minSdkVersion 18
        targetSdkVersion 25
        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(include: ['*.jar'], dir: 'libs')
    androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })

    implementation 'com.android.support:appcompat-v7:25.1.1'
    testImplementation 'junit:junit:4.12'
    implementation 'com.jjoe64:graphview:4.2.2'
    implementation 'com.jakewharton:butterknife:8.8.1'
    annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
}

【讨论】:

  • 您使用的版本不存在。检查我编辑的答案。
  • 但是当我这样做时,我收到了这个错误: > 现在必须明确声明注释处理器。发现编译类路径的以下依赖项包含注释处理器。请将它们添加到 annotationProcessor 配置中。 - butterknife-5.1.2.jar (butterknife-5.1.2.jar) 或者,设置 android.defaultConfig.javaCompileOptions.annotationProcessorOptions.includeCompileClasspath = true 以继续之前的行为。请注意,此选项已弃用,将来会被删除。
猜你喜欢
  • 2019-03-04
  • 2021-01-05
  • 2020-11-21
  • 1970-01-01
  • 2018-10-11
  • 2017-07-23
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多