Android - how to add @hide annotation in my project(Android - 如何在我的项目中添加@hide 注释)
问题描述
我正在开发 SDK,我想将 @hide 注释用于我不希望使用我的 SDK 的用户看到的方法/类.(与 活动实施 - 第 3898 行)
I'm developing SDK, and I would like to use @hide annotation for methods/classes which I don't want to be visible for the user who uses my SDK. (same as in Activity implementation - line 3898)
我尝试添加 @hide 注释,但我发现没有任何反应.为了使用 @hide 注释/或任何其他类似的解决方案来封装我的内部 SDK 的类/方法,我需要做什么.
I tried just to add @hide annotation but I saw that nothing happens. What should I need to do in order to use @hide annotation/or any other similar solution for encapsulating my internal SDK's classes/methods.
推荐答案
在Android SDK中,@hide注解只在构建android.jar.在编译时从这个存根 jar 导入符号,并且只有非隐藏符号可用.在设备或模拟器中运行时,符号位于平台库中,例如可以通过反射看到它们.
In Android SDK, the @hide annotation is only used when building the stub version of android.jar. At compile-time symbols are imported from this stub jar and only non-hidden symbols are available. At runtime in device or emulator the symbols are there in the platform libraries and they can be seen for example via reflection.
如果你的 SDK 只包含一个 jar 文件或类似的东西,那么真的没有办法在其中隐藏符号.
If your SDK only consists of a jar file or something similar, there really isn't a way to hide symbols in it.
这篇关于Android - 如何在我的项目中添加@hide 注释的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Android - 如何在我的项目中添加@hide 注释
基础教程推荐
- 将 double 转换为 Int,向下舍入 2022-01-01
- doFilter()是在servlet的工作完成之前还是之后执行的? 2022-01-01
- Maven:无效的目标版本:10 2022-01-01
- Java ECDSAwithSHA256 签名长度不一致 2022-01-01
- JPA惰性列表上的流 2022-01-01
- 将 Windows 证书导入 Java 2022-01-01
- 在springboot中如何给mybatis加拦截器 2023-04-29
- 如何在相机中应用自定义滤镜 [Surfaceview 预览]. 2022-01-01
- 在java中使用xpath和selenium解析HTML表格数据 2022-01-01
- 控制台应用程序中的 Java 键盘输入解析 2022-01-01
