java.lang.IllegalStateException: Required view 'nav' with ID 2131558567 for field

java.lang.IllegalStateException: Required view 'nav' with ID 2131558567 for field 'mAHBottomNavigation' was not found. If this view is optional add '@Nullable' (fields) or '@Optional' (methods) annotation.

原因:BaseActivity忘记加这一行:this.setContentView(this.getLayoutId());

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // 设置不能横屏,防止生命周期的改变
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_NOSENSOR);
        this.setContentView(this.getLayoutId());//缺少这一行
        ButterKnife.bind(this);//绑定ButterKnife
        mContext = this;
        this.initView();
        this.initData();
        this.initEvent();
        Timber.tag(TAG).i("-->onCreate()");
    }

    /**
     * 获取布局id
     *
     * @return
     */
    protected abstract int getLayoutId();

你可能感兴趣的:(java.lang.IllegalStateException: Required view 'nav' with ID 2131558567 for field)