resValue gradle error: Unsupported type “String” in “generated.xml”

青春壹個敷衍的年華 提交于 2019-11-28 05:17:09

I solved adding the resources also in the defaultConfig block. For you it would be something like:

android {
    defaultConfig {
        resValue "string", "RES_FOO", "RES FOO RELEASE"
    }

    buildTypes {
        debug{
            buildConfigField "String", "FOO", "\"FOO DEBUG\""
            resValue "string", "RES_FOO", "RES FOO DEBUG"
        }
        release {
            buildConfigField "String", "FOO", "\"FOO RELEASE\""
            resValue "string", "RES_FOO", "RES FOO RELEASE"
        }
    }
}

Please note that:

  • item type must be string and not String
  • item name must not contain spaces (as normal resource name)

EDIT: Since 0.8.3 it should works fine just declaring the resValue in the build type block.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!