使用Android studio使用Alt+Enter自动创建activity.java时,会报错:
2020-03-24 12:57:22.268 26087-26087/com.example.helloandroidstu E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.helloandroidstu, PID: 26087
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.helloandroidstu/com.example.helloandroidstu.Activity_fifth}: java.lang.IllegalAccessException: java.lang.Class<com.example.helloandroidstu.Activity_fifth> is not accessible from java.lang.Class<android.app.Instrumentation>
这是因为默认生成的class没有public修饰符,加上之后app就不会关闭重启了