Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个接收器
<receiver android:name=".AlarmReceiver" />
但是接收者的类名是 AlarmReciver (拼写错误)
为什么android-sdk在运行时显示这个错误或显示这个?
因为该类是通过反射加载的,所以编译器不知道该类不存在(对于编译器,这是 a String,而不是类名)。当 JVM 将尝试通过反射加载该类时,它应该抛出一个ClassNotFoundException指示没有这样的类。
String
ClassNotFoundException