Android Studio 3.0 Flavor Dimension Issue

后端 未结 7 1651
我寻月下人不归
我寻月下人不归 2020-12-04 05:49

Upgraded to Studio Canary build. My previous project of Telegram Messenger is giving following error.

Error:All flavors must now belong to a named fla

7条回答
  •  情歌与酒
    2020-12-04 06:53

    Here you can resolve this issue, you need to add flavorDimension with productFlavors's name and need to define dimension as well, see below example and for more information see here https://developer.android.com/studio/build/gradle-plugin-3-0-0-migration.html

    flavorDimensions 'yourAppName' //here defined dimensions
    productFlavors {
        production {
            dimension 'yourAppName' //you just need to add this line
            //here you no need to write applicationIdSuffix because by default it will point to your app package which is also available inside manifest.xml file.
    
        }
    
        staging {
            dimension 'yourAppName' //added here also
            applicationIdSuffix ".staging"//(.staging) will be added after your default package name.
            //or you can also use applicationId="your_package_name.staging" instead of applicationIdSuffix but remember if you are using applicationId then You have to mention full package name.
            //versionNameSuffix "-staging"
    
        }
    
        develop {
            dimension 'yourAppName' //add here too
            applicationIdSuffix ".develop"
            //versionNameSuffix "-develop"
    
        }
    

提交回复
热议问题