编译错误,说资源名称必须以字母开头

时间:2018-03-21 11:10:56

标签: android android-studio merge android-gradle

Error:Execution failed for task ':app:mergeDebugResources'.
> C:\Users\vipin\Desktop\working\chatbot-watson-android\app\src\main\res\values\config.xml: Error: The resource name must start with a letter.

我无法找到错误。我的gradle版本是3.0.1。 我的config.xml文件位于下方。



<?xml version="1.0" encoding="utf-8"?>
    <!--suppress ALL -->    
    <resources>
     <!-- Watson Conversation Service Credentials -->

    <string name="02b40d22-cf18-49f6-a209-29167f5e51b2"></string>

    <string name="0ea4b080-6bdd-48d8-b327-c8d4e4939c"></string>

    <string name="oJFe0L4Svsbk"></string>



    <!--Watson Speech-To-Text Service Credentials-->

    <string name="STT_username"></string>

    <string name="STT_password"></string>



    <!--Watson Text-To-Speech Service Credentials-->

    <string name="TTS_username">9a50095e-b6a7-4f05-80b0-3c5192f07e38</string>


    <string name="TTS_password"></string>

    <!--Bluemix Mobile Analytics-->

    <string name="mobileanalytics_apikey">5bc78043-759d-4e52-9355-861b406bdaef</string>
</resources>
&#13;
&#13;
&#13;

请帮忙!

2 个答案:

答案 0 :(得分:3)

替换为以下

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <!-- Watson Conversation Service Credentials -->
    
    <string name="workspace_id">02b40d22-cf18-49f6-a209-29167f5e51b2</string>
    
    <string name="conversation_username">0ea4b080-6bdd-48d8-b327-c8d4e4939c</string>
    
    <string name="conversation_password">oJFe0L4Svsbk</string>
    
    
<!--Watson Speech-To-Text Service Credentials-->
    
    <string name="STT_username"></string>
    
    <string name="STT_password"></string>
    
    

    <!--Watson Text-To-Speech Service Credentials-->
    
    <string name="TTS_username">9a50095e-b6a7-4f05-80b0-3c5192f07e38</string>
    
    
    <string name="TTS_password"></string>

    <!--Bluemix Mobile Analytics-->
    
    <string name="mobileanalytics_apikey">5bc78043-759d-4e52-9355-861b406bdaef</string>
</resources>

答案 1 :(得分:0)

您必须将所提及的资源名称更改为方便的名称。 例如,而不是写:

<string name="02b40d22-cf18-49f6-a209-29167f5e51b2"></string>

将其更改为:

<string name="watson_credential_1">02b40d22-cf18-49f6-a209-29167f5e51b2</string>

您必须将资源名称更改为以字母开头, 这是什么意思资源名称必须以字母开头。