AngeloAvv / flutter_flavorizr

A flutter utility to easily create flavors in your flutter application
https://pub.dev/packages/flutter_flavorizr
MIT License
456 stars 81 forks source link

App name with single quote for Android #272

Open wer-mathurin opened 2 months ago

wer-mathurin commented 2 months ago

@AngeloAvv

The problem is when you have an app name with a single quote on ANDROID

flavors:
  dev:
    app:
      name: "app's name"
...

The generated gradle is

...
productFlavors {
        dev {
            dimension "flavor-type"
            applicationId "XXXXXXXXXX"
            resValue "string", "app_name", "app's name"
...

But it will fail (at least n AGT8) because the single quote in the string generate an error when building the android app. The correct way of doing it, is adding the \:

...
productFlavors {
        dev {
            dimension "flavor-type"
            applicationId "XXXXXXXXXX"
            resValue "string", "app_name", "app\\'s name"
...

Thanks to the order of the processors we are able to do a WORKAROUND by adding manually a resValues :-)

flavors:
  dev:
    app:
      name: "app's name"

    android:
      applicationId: "XXXXXXXXX"
      icon: "XXXXXXXXXXXXX"
      resValues:
        app_name:
          type: "string"
          value: "app\\\\'s name"
...

Would be awesome to do it by default according to the platform.