我正在尝试配置 restrictions在我的应用程序中,但出现以下错误
Error:(8, 30) String types not allowed (at 'description' with value 'Public Albums of this username will be fetched'). Error:Execution failed for task ':app:processDebugResources'. com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Users\athakur\Softwares\adt-bundle-windows-x86_64-20140702\sdk\build-tools\22.0.1\aapt.exe'' finished with non-zero exit value 1
我的app_restriction.xml如下——
<?xml version="1.0" encoding="utf-8"?>
<restrictions xmlns:android="http://schemas.android.com/apk/res/android" >
<restriction
android:key="google_username"
android:title="Google Username"
android:restrictionType="string"
android:description="Public Albums of this username will be fetched"
android:defaultValue="opensourceforgeeks" />
</restrictions>
如果我删除描述,它会正常工作。我使用了与 android dev page 中指定的相同语法即
<?xml version="1.0" encoding="utf-8"?>
<restrictions xmlns:android="http://schemas.android.com/apk/res/android" >
<restriction
android:key="downloadOnCellular"
android:title="App is allowed to download data via cellular"
android:restrictionType="bool"
android:description="If 'false', app can only download data via Wi-Fi"
android:defaultValue="true" />
</restrictions>
不确定我错过了什么。感谢您的帮助。
最佳答案
限制元素的描述值必须是字符串资源,如记录here .因此,提取硬编码文本将修复构建。
关于android - 错误 :(8, 30) 不允许使用字符串类型(在 'description' 处,值为 'Public Albums of this username will be fetched'),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32780543/