从 SDK 隐藏资源 ID

Hide Resource ID's from SDK

我开发了一个 SDK,其中包含一个带有一些敏感输入字段的布局。 本SDK将提供给第三方App。 一切正常。

问题是, 我不希望第三方应用程序从输入字段中获取任何信息。但是在使用该 SDK(.aar 文件)时他可以获得那些 SDK 输入字段的资源 ID

如何防止资源 ID 被暴露。

第三方应用中用于集成SDK的代码,

Intent intent = new Intent();
        intent.setComponent(new ComponentName("com.package_name", "com.package_name.class_name"));
        startActivity(intent);

I don't want third party App to fetch any of information from the input fields

这是他们应用程序中的代码。他们可以得到任何他们想要的东西。

What can be done to prevent the resource id's from been exposed.

如果"exposed",你的意思是"available at compile time as simple R constants",你可以whitelist the IDs that should be public,构建工具会隐藏剩余部分。

请注意,这不会阻止相关方从他们自己的进程中访问这些字段。它只会增加几分钟的开发过程。