Could I contain permission name in string res

2019-02-23 00:40发布

问题:

Sample code:

<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?

回答1:

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

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