我可以在字符串res中包含权限名称吗 [英] Could I contain permission name in string res

查看:100
本文介绍了我可以在字符串res中包含权限名称吗的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

示例代码:

<permission
    android:name="@string/permission_name"
    android:protectionLevel="signature" >
</permission>

构建时出错:元素中缺少名称属性.

Error while building: missing name attribute in element .

但是我不想在不同的应用程序中重复权限名称. 是否存在某种修复方法并在资源中包含权限?

But I don't want to duplicate permission name in my different applications. Is exist some way for fix it and contain permission in resources?

推荐答案

不,那是不可能的.在此处看看.您可以使用资源指定标签,但不能指定名称:

No, that's impossible. Take a look here. You can use resources to specify a label, but not the name:

名称必须唯一,因此应使用Java风格的作用域-例如,"com.example.project.PERMITTED_ACTION".

The name must be unique, so it should use Java-style scoping — for example, "com.example.project.PERMITTED_ACTION".

这篇关于我可以在字符串res中包含权限名称吗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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