1. 程式人生 > >解決辦法:error: inner element must either be a resource reference or empty.

解決辦法:error: inner element must either be a resource reference or empty.

  今天在linux上編譯程式碼,結果出錯了:

error: <item> inner element must either be a resource reference or empty.

看看程式碼:

    <array name="network">
        <item name="mqtt_host_name">192.167.0.151</item>
        <item name="mqtt_host_port">1883</item>
    </array>

  從意思來看,要求item內,要麼是引用別的資源,要麼是空。這樣意思更嚴格。改成:

    <string  name="mqtt_host_name">192.167.0.151</string>
    <integer name="mqtt_host_port">1883</integer>

    <array name="network_release">
        <item>@string/mqtt_host_name</item>
        <item>@integer/mqtt_host_port</item>
    </array>