Android的工作室0.4安培;牛油刀 [英] Android Studio 0.4 & Butter Knife
问题描述
我无法获得Android的工作室0.4(摇篮工程)及杰克沃顿商学院的黄油刀中发挥得很好。该参考视图(ViewPager这是应该得到注入始终为空。
我试着让注释处理(设置 - >编译器 - >注释处理器 - >启用注释处理)和清洁,但它仍然无法正常工作
修改:
在情况下,它的相关性,认为我试图注入是一个 android.support.v4.view.ViewPager
编辑2: 完整的解决方案:
buildScript {
库{
行家{
URLhttps://oss.sonatype.org/content/repositories/snapshots/
}
}
依赖{
...
类路径com.jimdo.gradle:摇篮 - 易 - 插件:0.2快照
}}
应用插件:'易'
安卓{
butterknifeVersion =4.0.1
依赖{
容易com.jakewharton:butterknife:$ {butterknifeVersion}
编译com.jakewharton:butterknife:$ {butterknifeVersion}
}
}
尝试编译之前运行的注释处理工具
相关{
易'com.jakewharton:butterknife:(插入最新版)
编译com.jakewharton:butterknife:(插入最新版)
}
检查了这一点:<一href="http://stackoverflow.com/a/20742913/1473536">http://stackoverflow.com/a/20742913/1473536
I'm unable to get Android Studio 0.4 (gradle project) & Jake Wharton's Butter Knife to play well together. The reference to the view (ViewPager that's supposed to get injected is always null.
I've tried enabling annotation processing (Settings -> Compilers -> Annotation Processors -> Enable annotation processing) and cleaning, but it still doesn't work.
Edit:
In case it's of relevance, the view I'm trying to inject is a android.support.v4.view.ViewPager
Edit 2: Complete solution:
buildScript {
repositories {
maven {
url "https://oss.sonatype.org/content/repositories/snapshots/"
}
}
dependencies {
...
classpath 'com.jimdo.gradle:gradle-apt-plugin:0.2-SNAPSHOT'
} }
apply plugin: 'apt'
android {
butterknifeVersion = '4.0.1'
dependencies {
apt "com.jakewharton:butterknife:${butterknifeVersion}"
compile "com.jakewharton:butterknife:${butterknifeVersion}"
}
}
Try run the annotation processing tool before the compile
dependency {
apt 'com.jakewharton:butterknife:(insert latest version)'
compile 'com.jakewharton:butterknife:(insert latest version)'
}
Check this out: http://stackoverflow.com/a/20742913/1473536
这篇关于Android的工作室0.4安培;牛油刀的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!