butterknife icon indicating copy to clipboard operation
butterknife copied to clipboard

R2 class file not generated

Open davidandreoletti opened this issue 8 years ago • 11 comments

R2 file not generated (and not resolved).

Env: Butterknife 8.2.1 (and also tried with 8.2.0) Android Build Plugin : 2.10

davidandreoletti avatar Jul 24 '16 13:07 davidandreoletti

@JakeWharton I found a solution. The error occurs with classpath 'com.android.tools.build:gradle:2.1.0' but not with classpath 'com.android.tools.build:gradle:2.1.2.

This should likely be added in the documentation

davidandreoletti avatar Jul 24 '16 13:07 davidandreoletti

This should likely be added in the documentation

No it should be fixed, but there's not really enough information to figure out what's going on here. Can you reproduce the issue in a sample project we can look at?

JakeWharton avatar Jul 25 '16 01:07 JakeWharton

For what it's worth I've had no issues with 2.1.0 and Butter Knife 8.2.1 for library projects. I would take a look at https://github.com/JakeWharton/butterknife/blob/master/sample/library/build.gradle to see if you might be missing something.

rogerhu avatar Jul 26 '16 18:07 rogerhu

In my case , both 2.1.0 and 2.1.2 have problem. R2 file not generated

330939204 avatar Aug 05 '16 07:08 330939204

@330939204 Try doing ./gradlew clean and building again, that solved it for me.

NickFirmani avatar Aug 12 '16 23:08 NickFirmani

@NickFirmani clean doens't work for me R2 doesn't create on 2.1.0 and 2.1.2

DimaKTheAweome avatar Sep 06 '16 16:09 DimaKTheAweome

R2 not getting created did any one find the solution even i am not able to use jackson

narendrakothamire avatar Sep 08 '16 16:09 narendrakothamire

I just experienced this problem too.

Butterknife 8.4.0 Windows 10 AS 2.2.2

The ./gradlew clean did not help either.

I did not have time to try much more and I just got an upgrade for AS to 2.2.3, afterwards it appeared without any hassle.

HGyllensvard avatar Dec 06 '16 22:12 HGyllensvard

I solved by making a fresh gradle build with commands:

clean assembleDebug

aviadmini avatar Dec 19 '16 02:12 aviadmini

I solved this by upgrading to 8.2.1. (Due to project requirement I can not use annotationProcessor)

aldoKelvianto avatar Jul 11 '17 13:07 aldoKelvianto

I have solved this issue, Just follow these steps:

  1. Add dependency correctly

    implementation 'com.jakewharton:butterknife:10.2.1'. annotationProcessor 'com.jakewharton:butterknife-compiler:10.2.1' kapt 'com.jakewharton:butterknife-compiler:10.2.1'

//then add a plugin at the bottom: apply plugin: 'com.jakewharton.butterknife'

----> follow Butterknife dependency doc.

  1. In the terminal write: ./gradlew clean and rebuild project

This will surely help!

manisha-khatri avatar Jun 16 '20 07:06 manisha-khatri