使用ButterKnife和最新Android Studio的java.lang.NoClassDefFoundError

时间:2015-08-10 16:56:30

标签: android android-studio butterknife

我今天刚升级我的Android Studio,并在使用ButterKnife 7.0.2-Snapshot 编译项目时遇到此错误。

Caused by: java.lang.NoClassDefFoundError: android/view/View
        at butterknife.internal.BindingClass.createBindMethod(BindingClass.java:132)
        at butterknife.internal.BindingClass.brewJava(BindingClass.java:109)
        at butterknife.internal.ButterKnifeProcessor.process(ButterKnifeProcessor.java:131)
        at com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(JavacProcessingEnvironment.java:794)
        at com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs(JavacProcessingEnvironment.java:705)
        at com.sun.tools.javac.processing.JavacProcessingEnvironment.access$1800(JavacProcessingEnvironment.java:91)
        at com.sun.tools.javac.processing.JavacProcessingEnvironment$Round.run(JavacProcessingEnvironment.java:1035)
        at com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(JavacProcessingEnvironment.java:1176)
        at com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:1170)
        at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:856)
        at com.sun.tools.javac.main.Main.compile(Main.java:523)
        ... 76 more
Caused by: java.lang.ClassNotFoundException: android.view.View
        ... 87 more

其他人有这个问题吗?代码没有改变。

1 个答案:

答案 0 :(得分:0)

不确定错误发生的原因,但降级到7.0.1允许构建编译。

compile 'com.jakewharton:butterknife:7.0.1'