android - 错误 :(8, 30) 不允许使用字符串类型(在 'description' 处,值为 'Public Albums of this username will be fetched')

标签 android android-resources aapt android-restrictions

我正在尝试配置 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/

相关文章:

android - 在三星设备上使用蓝牙低功耗时什么也没发现

android - Android XmlResourceParser 的方便使用?

android - 资源覆盖

java - 使用 Ant 构建一个包含 ActionbarSherlock 作为库项目的项目

java - 非法字符 < :> at index 40: com. 识别.app-mergeDebugResources-33 :/values/values. xml)

java - 从我的数据库android获取密码。

java - Android-在Handler/runnable中启动新的Activity真的很慢

android-studio - Android Studio 每次都会导致蓝屏

带有图像 url 的 Android Facebook API 墙贴无法正常工作

android - 如何在android中存储具有相同名称但扩展名不同的资源文件