Question

I'm using SherlockActivity (I know not to use it, but I need it for this project) and i'm trying to get ButterKnife to work with it. For some reason, I keep getting a series of errors and i'm not sure why, as I'm following the documentation. My code is as per below:

public class ViewMessageActivity extends SherlockActivity {

    @InjectView(R.id.id_message_list)
    ListView listView;

    @OnItemClick(R.id.id_message_list)
    void onItemClick(int position) {
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.message_details);
        ButterKnife.setDebug(true);
        ButterKnife.inject(this);

The errors i'm getting are below:

ButterKnife﹕ Looking up view injector for com.app.ViewMessageActivity
ButterKnife﹕ Not found. Trying superclass com.actionbarsherlock.app.SherlockActivity
ButterKnife﹕ Not found. Trying superclass android.app.Activity
ButterKnife﹕ MISS: Reached framework class. Abandoning search.

Is there any reason for this? I followed documentation on this page:

http://jakewharton.github.io/butterknife/

and the sample:

https://github.com/JakeWharton/butterknife/blob/master/butterknife-sample/src/main/java/com/example/butterknife/SimpleActivity.java

Was it helpful?

Solution

For some reason my settings in Android Studio were reverted, not sure how. But make sure annotation processing is enabled in Android Studio.

Screenshot explains it all.

enter image description here

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top