Android Studio找不到com.jakewharton:butterknife-compiler:5.1.2

时间:2018-11-07 18:43:42

标签: android android-studio jar

我正在尝试构建我的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   要求:       项目:app

这是我的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
}
 }

有人可以帮我吗?

1 个答案:

答案 0 :(得分:0)

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

repositories {
    mavenCentral()
}

此外,您使用的5.1.2版本不存在:

  

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

尝试以下文件:

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'
}