Android的 - 如何添加@hide标注在我的项目 [英] Android - how to add @hide annotation in my project

查看:650
本文介绍了Android的 - 如何添加@hide标注在我的项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发的SDK,我想用@hide标注的方法/我不想成为谁使用我的SDK中的用户可见的类。 (同<一个href="https://android.googlesource.com/platform/frameworks/base/+/android-2.3.5_r1/core/java/android/app/Activity.java"相对=nofollow>活动的实施 - 线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中,建<$ C的存根版本时, @hide 注释仅用于$ C>的android.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标注在我的项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆