Android 公共库资源未解析

Android public library resource not resolved

提问人:F.M. 提问时间:9/20/2023 更新时间:9/20/2023 访问量:7

问:

在库com.example.mylibrary中,我有这个strings.xml文件:

<resources>
    <string name="cde_test_private">This is a private string</string>
    <public type="string" name="cde_test_public">this is a public string</public>
</resources>

我通过 MavenLocal 在我的应用程序 com.example.myapp 中成功导入了 com.example.mylibrary,我在 gradle.properties 中设置了 android.nonTransitiveRClass=false ,因此我可以成功使用 com.example.mylibrary 中的 com.example.mylibrary 资源。

无论如何,对于这些字符串,有些东西不起作用: cde_test_private一切正常,我看到了它,但我正确地无法使用它:enter image description here

但我不能同意cde_test_public:

enter image description here

似乎没有解决\导入。

怎么了? 如何在相同的字符串.xml中标记字符串以供外部使用?

Android 字符串 资源 私有 公共

评论


答: 暂无答案