1

after my suffering from findViewById I decided to use ButterKnife but nice bug told me that you will never ues ButterKnife here is the error

@InjectView-annotated class incorrectly in Android framework package.

why? where is my mistake? is gradle dependency wrong?

I saw this post but it didn't help me

gradle file (module)

apply plugin: 'com.neenbedankt.android-apt'
buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
    }
}

dependencies {
    compile 'com.jakewharton:butterknife:8.0.1'
    apt 'com.jakewharton:butterknife-compiler:8.0.1'
}

the error in this line

@BindView(R.id.button_birth_date)
private Button buttonBirthDate;

and other member variables(views) that uses @BindView

Community
  • 1
  • 1
Basheer AL-MOMANI
  • 14,473
  • 9
  • 96
  • 92

3 Answers3

10

By Jake Wharton, The exception says it all:

@InjectView-annotated class incorrectly in Android framework package. 

Your class is in the Android framework package, android.. Applications should not use the android. or java.* packages for their code. ButterKnife will eagerly reject these packages.

Change your package name. android.alcode.com.material to something.alcode.com.material

USKMobility
  • 5,721
  • 2
  • 27
  • 34
2

your package name mustn't contain android word on it

so make sure that your application package name doesn't contain android word on it

Basheer AL-MOMANI
  • 14,473
  • 9
  • 96
  • 92
0

If you use the last Butterknife you do use Butterknife.bind(this) not Butterknife.inject(this), for view use @Bind(R.id.idview) not @InjectView(R.id.idview). See documentation

Edit: Change your package name, you can't'use android.* or java.*, Jake Wharton answer solution