使用AndroidAnnotations
时,从基类继承时遇到问题。我有一个名为BaseActivity
的基本活动:
@EActivity
public abstract class BaseActivity extends AppCompatActivity {
@ViewById
Toolbar toolbar;
@ViewById(R.id.drawer_layout)
DrawerLayout drawerLayout;
@ViewById(R.id.nav_view)
NavigationView navView;
}
我还有一个名为MainActivity
的儿童活动:
@EActivity(R.layout.activity_main)
public class MainActivity extends BaseActivity {
@ViewById
ImageButton btnTabHome;
}
当我构建项目时出现以下错误:
****MyProjectBuildPath****\MainActivity_.java
Error:(82, 13) error: toolbar is not public in BaseActivity; cannot be accessed from outside package
Error:(83, 13) error: drawerLayout is not public in BaseActivity; cannot be accessed from outside package
Error:(84, 13) error: navView is not public in BaseActivity; cannot be accessed from outside package
Error:(90, 9) error: cannot find symbol method initBaseViews()
如果我从BaseActivity_
继承,则会收到以下错误:
****MyProjectBuildPath****\MainActivity.java
Error:(19, 35) error: cannot find symbol class BaseActivity_
Error:(17, 1) error: org.androidannotations.annotations.EActivity can only be used on an element that extends android.app.Activity
Warning:(19, 8) Element packagename.MainActivity invalidated by EActivityHandler
我的错误在哪里?