gpt4 book ai didi

android - 为什么 AppCompatActivity 不像 Activity 那样抛出 RuntimeException ("Stub!")?

转载 作者:行者123 更新时间:2023-11-28 20:27:03 24 4
gpt4 key购买 nike

我在查看 AppCompatActivity 和 Activity 的反编译 .class 文件时注意到,虽然 Activity.class 中的每个方法都抛出了运行时异常

throw new RuntimeException("Stub!");

但是 AppCompatActivity 却不是这样,是否有相同的原因?

我知道 android.jar 只包含 android 依赖项的 stub 实现,但对于支持库类来说也不一样吗?

最佳答案

I know that android.jar only contains stub implementations of android dependencies

那是因为框架类的真正实现是固件的一部分。 android.jar 只是为了让编译器开心。

isn't the same true for support library classes as well?

不,因为类的真正实现是在库本身中,将被编译到您的应用中。

关于android - 为什么 AppCompatActivity 不像 Activity 那样抛出 RuntimeException ("Stub!")?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52138133/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com