Butterknife 8.1.0不能与Android Studio 2.1.2中的JDK 1.8一起使用

苏纳克·雷(Sounak Ray)

我是Android,Android Studio,Butterknife和Gradle构建系统的新手。但是,我对Java或一般的编程并不陌生。

我正在尝试使用JDK 1.8和Butterknife版本8.1.0构建Android应用程序,但是Gradle构建一直失败,并说:

错误:在任务':app:compileDebugJavaWithJack'上找不到属性'options'。

注意:在我尝试添加Butterknife之前,我的项目与JDK 1.8完美配合(“即时运行”功能除外)。

我已经对此进行了一些研究,并仔细阅读了以下页面/文章,但无法获得关于Butterknife 8.1.0是否与JDK 8兼容的问题的明确答案:

真的有用吗?如果是,我需要怎么做才能使其正常工作?

以下是我的项目设置的详细信息,以及Gradle构建文件中的摘要。我很乐意提供可能需要的任何其他详细信息/文件。

版本详细信息:

  • JDK 1.8.0_92(64位)
  • Android Studio 2.1.2
  • 摇篮2.1.2

build.gradle(项目级别)

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
//        jcenter()
        mavenCentral()
    }
    dependencies {
        classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
        classpath 'com.android.tools.build:gradle:2.1.2'

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

allprojects {
    repositories {
        jcenter()
    }
}

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

build.gradle(模块级别)

apply plugin: 'com.android.application'
apply plugin: 'android-apt'

android {
    compileSdkVersion 24
    buildToolsVersion "24.0.0"

    defaultConfig {
        applicationId "sounakray.popularmovies"
        minSdkVersion 15
        targetSdkVersion 24
        versionCode 1
        versionName "1.0"
        jackOptions {
            enabled true
        }
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

repositories {
    mavenCentral()
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:24.0.0'
    compile 'com.android.support:design:24.0.0'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.android.volley:volley:1.0.0'
    compile 'com.google.code.gson:gson:2.7'
    compile 'com.jakewharton:butterknife:8.1.0'
    apt 'com.jakewharton:butterknife-compiler:8.1.0'
}

解决方案已更新

通过遵循Jake的答案,我可以通过在两个build.gradle文件中进行以下更改来使Butterknife 8.1.0与AS 2.1.2中的JDK 8一起使用:

build.gradle(项目级别)

dependencies {
    classpath 'com.android.tools.build:gradle:2.2.0-alpha5'
}

build.gradle(模块级别)

apply plugin: 'com.android.application'
//apply plugin: 'android-apt'
...

dependencies {
    ...
    compile 'com.jakewharton:butterknife:8.1.0'
    annotationProcessor  'com.jakewharton:butterknife-compiler:8.1.0'
}
杰克·沃顿

如果使用杰克:

  • 完全省略“ android-apt”插件。
  • 使用annotationProcessor的依赖关系(而不是apt)。

我相信您必须使用Android Gradle插件的2.2.0版本,而不是2.1.x(当前最新版本是2.2.0-alpha5)。

黄油刀文档将在下一个版本(8.2.0)中进行更新,以包含此信息。

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

Butterknife 8.1.0不能与Android Studio 2.1.2中的JDK 1.8一起使用

来自分类Dev

在1个片段中使用具有2个不同视图的ButterKnife库

来自分类Dev

Android Studio 2.2。预览1错误:“请使用JDK 8或更高版本”

来自分类Dev

为什么3-1 * 8 + 2 * 3等于1

来自分类Dev

我想把数组 [1,2,3,4,5,6,7,8,9,10,11] 变成数组 [1,2,3,4,5,6,7,8,9,1 ,0,1,1] 仅使用此算法

来自分类Dev

是否可以将向量索引 1 与列表元素 1、索引 2 与元素 2 等一起使用?

来自分类Dev

C中{0,1,2,3,4,5,6,7,8,9}外的条件

来自分类Dev

Leaflet 1 Beta 2无法与mapbox-gl.js一起使用

来自分类Dev

使用Scala收集方法可帮助将[0,0,0,1,1,1,1,0,0,1,1]的列表转换为[3,4,2,2]

来自分类Dev

将MINLOC与Fortran一起使用:不兼容的分配中的等级0和1

来自分类Dev

逐步添加DIV ... 1、2、3、4、8、16

来自分类Dev

逐步添加DIV ... 1、2、3、4、8、16

来自分类Dev

RailsTutorial第8章错误的参数数量(1对2)

来自分类Dev

拆分整数 8 --> [1,7],[2,6]

来自分类Dev

在Angular 8中使用Redux在1个效果中返回2个动作

来自分类Dev

我正在尝试将I2C与beaglebone一起使用,但我不能写超过1个字节

来自分类Dev

在R中将(0,1,0,0,1,1,1)转换为(0,0,0,1,0,1,2)

来自分类Dev

将数组的元素添加为a [0],a [1] + a [2],a [3] + a [4] + a [5],a [6] + a [7] + a [8] + a [9] ...等等

来自分类Dev

ValueError:操作数不能与形状(1,55)(42,)一起广播

来自分类Dev

为什么1/2 == 0使用double?

来自分类Dev

与Jersey 1一起使用https

来自分类Dev

错误:操作数无法与形状一起广播 (1776,1,2) (3896,1,2)

来自分类Dev

Android - 获取数字的索引 #0 、 #1 、 #2

来自分类Dev

jaxb2-maven-plugin:schemagen是否可与JDK8一起使用?

来自分类Dev

jaxb2-maven-plugin:schemagen是否可以与JDK8一起使用?

来自分类Dev

如何重复序列:r中的1,2,3,4,5,6,1,2,3,4,5,6,7,8,9,10,7,8,9,10

来自分类Dev

数据库值为 ["", "5", "1", "2", "8", "6", "9"] 在 Rails Console 中显示为 "[\"\", \"5\", \"1\"、\"2\"、\"8\"、\"6\"、\"9\"]"?

来自分类Dev

无法将Raspberry Pi Camera v1 / 2与Gumstix Pi Compute开发板一起使用

来自分类Dev

将php json_decode与1d和2d数组一起使用

Related 相关文章

  1. 1

    Butterknife 8.1.0不能与Android Studio 2.1.2中的JDK 1.8一起使用

  2. 2

    在1个片段中使用具有2个不同视图的ButterKnife库

  3. 3

    Android Studio 2.2。预览1错误:“请使用JDK 8或更高版本”

  4. 4

    为什么3-1 * 8 + 2 * 3等于1

  5. 5

    我想把数组 [1,2,3,4,5,6,7,8,9,10,11] 变成数组 [1,2,3,4,5,6,7,8,9,1 ,0,1,1] 仅使用此算法

  6. 6

    是否可以将向量索引 1 与列表元素 1、索引 2 与元素 2 等一起使用?

  7. 7

    C中{0,1,2,3,4,5,6,7,8,9}外的条件

  8. 8

    Leaflet 1 Beta 2无法与mapbox-gl.js一起使用

  9. 9

    使用Scala收集方法可帮助将[0,0,0,1,1,1,1,0,0,1,1]的列表转换为[3,4,2,2]

  10. 10

    将MINLOC与Fortran一起使用:不兼容的分配中的等级0和1

  11. 11

    逐步添加DIV ... 1、2、3、4、8、16

  12. 12

    逐步添加DIV ... 1、2、3、4、8、16

  13. 13

    RailsTutorial第8章错误的参数数量(1对2)

  14. 14

    拆分整数 8 --> [1,7],[2,6]

  15. 15

    在Angular 8中使用Redux在1个效果中返回2个动作

  16. 16

    我正在尝试将I2C与beaglebone一起使用,但我不能写超过1个字节

  17. 17

    在R中将(0,1,0,0,1,1,1)转换为(0,0,0,1,0,1,2)

  18. 18

    将数组的元素添加为a [0],a [1] + a [2],a [3] + a [4] + a [5],a [6] + a [7] + a [8] + a [9] ...等等

  19. 19

    ValueError:操作数不能与形状(1,55)(42,)一起广播

  20. 20

    为什么1/2 == 0使用double?

  21. 21

    与Jersey 1一起使用https

  22. 22

    错误:操作数无法与形状一起广播 (1776,1,2) (3896,1,2)

  23. 23

    Android - 获取数字的索引 #0 、 #1 、 #2

  24. 24

    jaxb2-maven-plugin:schemagen是否可与JDK8一起使用?

  25. 25

    jaxb2-maven-plugin:schemagen是否可以与JDK8一起使用?

  26. 26

    如何重复序列:r中的1,2,3,4,5,6,1,2,3,4,5,6,7,8,9,10,7,8,9,10

  27. 27

    数据库值为 ["", "5", "1", "2", "8", "6", "9"] 在 Rails Console 中显示为 "[\"\", \"5\", \"1\"、\"2\"、\"8\"、\"6\"、\"9\"]"?

  28. 28

    无法将Raspberry Pi Camera v1 / 2与Gumstix Pi Compute开发板一起使用

  29. 29

    将php json_decode与1d和2d数组一起使用

热门标签

归档