Rumah > Soal Jawab > teks badan
package com.aa.safe.safehei.activities;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.TextView;
import com.aa.safe.safe.R;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
public class DogActivity extends AppCompatActivity {
@BindView(R.id.tv_islocked_notselect)
TextView mTvIslockedNotselect;
@BindView(R.id.tv_islocked_select)
TextView mTvIslockedSelect;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_dog);
ButterKnife.bind(this);
}
}
使用butterknife后
在app/build/generated/source/apt/debug/包名/DogActivity$$ViewBinder
下提示报错
import butterknife.internal.Finder;
import butterknife.internal.ViewBinder;
提示这二个类找不到,我看了下的确是没有的
messages 窗口也提示找不到符号........
ringa_lee2017-04-17 17:58:35
@Bind(R.id.drawer_layout)
DrawerLayout drawerLayout;
@Bind(R.id.nav_view)
NavigationView navigationView;
@Bind(R.id.toolbar)
Toolbar toolbar;
@Bind(R.id.main_container)
FrameLayout mainContainer;
ActionBarDrawerToggle mActionBarDrawerToggle;
FragmentManager fragmentManager;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ButterKnife.bind(this);
···
}
你用的什么版本啊,7.0.1是这样的
compile 'com.jakewharton:butterknife:7.0.1'
怪我咯2017-04-17 17:58:35
我用的8.1.0的版本需要在gradle里面添加apt 'com.jakewharton:butterknife-compiler:8.1.0'
是用来进行预编译的,不知道7.0是不是需要