android.jar为什么不包含NetworkSecurityTrustManager?

huangapple go评论69阅读模式
英文:

Why android.jar does not contain NetworkSecurityTrustManager?

问题

我的compileSdk是33。

如果我在文件管理器中打开*/AndroidSdk/sources/android-33*,那么我可以找到android.security.net.config.NetworkSecurityTrustManager。它位于*/AndroidSdk/sources/android-33/android/security/net/config*中。

然而,如果我将*/AndroidSdk/platforms/android-33/android.jar解压到/unpacked中,那么在/unpacked中我找不到android.security.net.config.NetworkSecurityTrustManager*(我希望它在*/unpacked/android/security/net/config*中)。

看起来NetworkSecurityTrustManager存在于源代码中,但在android.jar中不存在。为什么会这样呢?

英文:

My compileSdk is 33.

If I open /AndroidSdk/sources/android-33 in file manager, then I can locate android.security.net.config.NetworkSecurityTrustManager. It resides in /AndroidSdk/sources/android-33/android/security/net/config.

However, if I unpack /AndroidSdk/platforms/android-33/android.jar into /unpacked, then within /unpacked I cannot find android.security.net.config.NetworkSecurityTrustManager (I expect it at /unpacked/android/security/net/config).

It seems that NetworkSecurityTrustManager exists in sources, but does not exist in android.jar. Why is that?

答案1

得分: 1

如果您查看源代码,您会看到它带有@hide注释:

/**
 * {@link X509ExtendedTrustManager} that implements the trust anchor and pinning for a
 * given {@link NetworkSecurityConfig}.
 * @hide
 */
public class NetworkSecurityTrustManager extends X509ExtendedTrustManager {

带有该注释的类不一定包含在android.jar中,因为它们不是Android SDK的一部分。

英文:

If you look at the source code, you will see that it is marked with the @hide annotation:

/**
 * {@link X509ExtendedTrustManager} that implements the trust anchor and pinning for a
 * given {@link NetworkSecurityConfig}.
 * @hide
 */
public class NetworkSecurityTrustManager extends X509ExtendedTrustManager {

Classes marked with that annotation are not necessarily included in android.jar, because they are not part of the Android SDK.

huangapple
  • 本文由 发表于 2023年3月21日 01:15:07
  • 转载请务必保留本文链接:https://go.coder-hub.com/75793342.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定