我需要安装插件黄油刀。我可以在哪里下载它?我下载了一个.jar插件(但是如果文件是我需要的),我已经安装了,但是当我点击“生成”选项时,不会出现使用butterknife的选项。下面的视频教程我修改过的文件摇篮建:我让他们现在如下:如何在Android Studio中设置ButterKnife插件?
apply plugin: 'android-apt'
apply plugin: 'com.android.application'
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
defaultConfig {
applicationId "calcursoedxleccion0.cal"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile "com.android.support:appcompat-v7:$rootProject.ext.supportLibraryVersion"
compile "com.android.support:recyclerview-v7:$rootProject.ext.supportLibraryVersion"
compile "com.android.support:support-v4:$rootProject.ext.supportLibraryVersion"
compile "com.android.support:design:$rootProject.ext.supportLibraryVersion"
// compile "com.jakewharton:butterknife:$rootProject.ext.butterKnifeVersion"
compile "com.jakewharton:butterknife:$rootProject.ext.butterKnifeVersion"
apt "com.jakewharton:butterknife-compiler:8.0.1"
}
和
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.2'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
// 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
}
ext{
minSdkVersion = 16
targetSdkVersion = 23
compileSdkVersion = 23
buildToolsVersion = '23.0.3'
supportLibraryVersion = '23.3.0'
butterKnifeVersion = '8.0.1'
}
摇篮同步我得到这个错误:
"The android android-library or plugin must be applied to the project" error (1.0)
我是什么做错了?
你为什么要定义分机{...}?将属性直接放在你的应用程序build.gradle –
你怎么知道它与Butterknife相关?这可能是因为你的分机值没有被正确导入 – gaara87