android异常描述 make sure class name exists, is public, and has an empty constructor that is public

异常简介

EXEPTION=Unable to start activity ComponentInfo{xxxx/xxxx.GameActivity}\: android.app.Fragment$InstantiationException\: Unable to instantiate fragment xxxx.GameView$GameDialog\: make sure class name exists, is public, and has an empty constructor that is public

原因:

GameDiag 必须被public修饰  必须有默认构造函数

当app在后台因内存不足被杀后 在最近任务中打开该app会重建被杀前的页面  由于是反射创建而这时被创建的组件如果没有默认构造函数就会抛该异常

猜你喜欢

转载自blog.csdn.net/nailsoul/article/details/81091264