ICode9

精准搜索请尝试: 精确搜索
首页?>?其他分享> 文章详细

android – 为什么butterknife 9.0.0-SNAPSHOT无法解析?

2019-09-30 10:34:19??阅读:6??来源: 互联网

标签:butterknife?android?androidx


我想使用AndroidX库,下面是Butterknife的Gradle设置

app:模块依赖

implementation 'com.jakewharton:butterknife:9.0.0-SNAPSHOT'
 annotationProcessor 'com.jakewharton:butterknife-compiler:9.0.0-SNAPSHOT'

插入

申请插件:’com.jakewharton.butterknife’

项目依赖

dependencies {
      classpath 'com.android.tools.build:gradle:3.3.0-alpha09'
      classpath 'com.google.gms:google-services:4.0.1'
      classpath 'com.jakewharton:butterknife-gradle-plugin:9.0.0-SNAPSHOT'
      // NOTE: Do not place your application dependencies here; they belong
      // in the individual module build.gradle files
    }

项目存储库

repositories {
        google()
        mavenCentral()
        maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
        jcenter()
    }

解决方法:

更新:
您现在可以简单地使用ButterKnife 9-rc02代替上述解决方案:

...
dependencies {
    implementation 'com.jakewharton:butterknife:9.0.0-rc2'
    annotationProcessor 'com.jakewharton:butterknife-compiler:9.0.0-rc2'
...

根据Naveen的回答,解决方案是here.
但是,缺少细节.请参阅以下Gradle配置以获取完整的解决方案:

buildscript {
    repositories {
        jcenter()
        google()
        maven { url "https://jitpack.io" }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.0-alpha10'
    }
}

allprojects {
    repositories {
        jcenter()
        google()
        maven { url "https://jitpack.io" }
        mavenCentral()
        maven {
            name 'Sonatype SNAPSHOTs';
            url 'https://oss.sonatype.org/content/repositories/snapshots/'
        }
    }
}

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

...
dependencies {
    implementation 'com.jakewharton:butterknife:9.0.0-SNAPSHOT'
    annotationProcessor 'com.jakewharton:butterknife-compiler:9.0.0-SNAPSHOT'
...

基本上,不要使用apply plugin:’com.jakewharton.butterknife’和classpath’com.jakewharton:butterknife-gradle-plugin:9.0.0-SNAPSHOT’来自建议here.

此外,此Android Studio设置>编译器配置:
Android Studio Settings > Compiler configuration



标签:butterknife,android,androidx

专注分享技术,共同学习,共同进步。侵权联系[admin#icode9.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有