How to replace a string for a buildvariant with gradle in android studio?

后端 未结 4 451
没有蜡笔的小新
没有蜡笔的小新 2020-12-01 03:54

I have two flavors of my project:

flavor1 -> packagename: com.example.flavor1 
flavor2 -> packagename: com.example.flavor2

Now I want

4条回答
  •  天涯浪人
    2020-12-01 04:16

    The answers are quite outdated, there are better ways now to archive it. You can use the command in your build.gradle:

    manifestPlaceholders = [
                myPlaceholder: "placeholder",
        ]
    

    and in your manifest:

    android:someManifestAttribute="${myPlaceholder}"
    

    more information can be found here: https://developer.android.com/studio/build/manifest-merge.html

提交回复
热议问题