JakeWharton / butterknife

Bind Android views and callbacks to fields and methods.
http://jakewharton.github.io/butterknife/
Apache License 2.0
25.56k stars 4.61k forks source link

Butterlnife view not setting for some ids #1470

Open williams98 opened 5 years ago

williams98 commented 5 years ago

After implementing butterknife to my project im getting this type issues Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.view.View.setVisibility(int)' on a null object reference

Lib used: implementation 'com.jakewharton:butterknife:8.8.1' annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'

Code used: @BindView(R.id.homepage_currentlocation) TextView currentlocation;

protected void onCreate(Bundle savedInstanceState) { requestWindowFeature(Window.FEATURE_NO_TITLE); super.onCreate(savedInstanceState); setContentView(R.layout.homepage); setUnBinder(ButterKnife.bind(this));

I have re-checked both xml id and bindview id its same , this issue happen some times alone.

JakeWharton commented 5 years ago

The only way this could happen is if the generated code wasn't found. Do you see it generated? Can you turn on debug logging and paste the logs?

williams98 commented 5 years ago

02-16 10:57:05.623 12045-12045/com.jobsearchtry D/ButterKnife: Looking up binding for com.jobsearchtry.ui.employer.Responses HIT: Loaded binding class and constructor.

This is my log its working fine but in some device im getting this type of issue . what will be cause of it ? is there problem with ids or with code?

JakeWharton commented 5 years ago

Seems like the generated code is present. Please paste its contents

limin13215 commented 4 years ago

With 8.8.1 , I also find this bug in Tecent Bugly; It happens more than 100 times.