How to replace strings resources with Android Gradle

前端 未结 4 955
感动是毒
感动是毒 2020-12-07 23:45

I made a new app with gradle in Android Studio, and now I need to make about 10 versions with different package names and values in resources. I made custom flavors as in ex

4条回答
  •  旧时难觅i
    2020-12-07 23:55

    These links may be helpful:

    • Using Gradle for building Android applications
    • Gradle Plugin User Guide

    And my filter definition using regex to replace something:

    from('res/') {
        include '**/*.xml'
        filter {
            line -> line.replaceAll(/YOUR_REGEX_TO_REPLACE_SOMETHING/, 'REPLACED_RESULT_EXPRESSION')
        }
    }
    into 'build/path/to/your/filtered/resources/'
    

提交回复
热议问题