Подтвердить что ты не робот

Проблема со вкусом Android Studio 3.0

Обновлен до Studio Canary build. Мой предыдущий проект Telegram Messenger дает следующую ошибку.

Ошибка: все ароматы теперь должны принадлежать названному вкусовому измерению. Аромат "armv7" не отнесен к размеру аромата. Подробнее... https://d.android.com/r/tools/flavorDimensions-missing-error-message.html

Что мне делать? Я уже видел эту ссылку, но не мог понять, что делать. Теперь у меня есть 3 варианта сборки, выпуск, debug и foss.

4b9b3361

Ответ 1

Если вам не нужен механизм, просто укажите случайное измерение аромата в build.gradle:

android { 
    ...
    flavorDimensions "default"
    ...
}

Для получения дополнительной информации обратитесь к руководству по миграции .

Ответ 2

После тщательного изучения и чтения я решил это сам. Решение состоит в том, чтобы добавить следующую строку в build.gradle.

flavorDimensions "versionCode"

android { 
       compileSdkVersion 24
       .....
       flavorDimensions "versionCode"
} 

Ответ 3

Здесь вы можете решить эту проблему, вам нужно добавить flavourDimension с именем productFlavors, а также определить размер, см. пример ниже и дополнительную информацию см. здесь 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"

    }

Ответ 4

Если вы не хотите использовать размеры, вы должны использовать эту строку

android { 
compileSdkVersion 24

...
flavorDimensions "default"
...
}

но если вы хотите использовать измерения размера, вы должны сначала объявить имя измерения, а затем использовать это имя после ЭТО пример из документации:

android {
...
buildTypes {
debug {...}
release {...}
}

  // Specifies the flavor dimensions you want to use. The order in which you
  // list each dimension determines its priority, from highest to lowest,
  // when Gradle merges variant sources and configurations. You must assign
  // each product flavor you configure to one of the flavor dimensions.
  flavorDimensions "api", "mode"

  productFlavors {
    demo {
  // Assigns this product flavor to the "mode" flavor dimension.
  dimension "mode"
  ...
}

full {
  dimension "mode"
  ...
}

// Configurations in the "api" product flavors override those in "mode"
// flavors and the defaultConfig block. Gradle determines the priority
// between flavor dimensions based on the order in which they appear next
// to the flavorDimensions property above--the first dimension has a higher
// priority than the second, and so on.
minApi24 {
  dimension "api"
  minSdkVersion 24
  // To ensure the target device receives the version of the app with
  // the highest compatible API level, assign version codes in increasing
  // value with API level. To learn more about assigning version codes to
  // support app updates and uploading to Google Play, read Multiple APK Support
  versionCode 30000 + android.defaultConfig.versionCode
  versionNameSuffix "-minApi24"
  ...
}

minApi23 {
  dimension "api"
  minSdkVersion 23
  versionCode 20000  + android.defaultConfig.versionCode
  versionNameSuffix "-minApi23"
  ...
}

minApi21 {
  dimension "api"
  minSdkVersion 21
  versionCode 10000  + android.defaultConfig.versionCode
  versionNameSuffix "-minApi21"
  ...
    }
  }
}
...

Ответ 5

Я использовал flavourDimensions для своего приложения в build.gradle (Модуль: приложение)

flavorDimensions "tier"

productFlavors {
    production {
        flavorDimensions "tier"
        //manifestPlaceholders = [appName: APP_NAME]
        //signingConfig signingConfigs.config
    }
    staging {
        flavorDimensions "tier"
        //manifestPlaceholders = [appName: APP_NAME_STAGING]
        //applicationIdSuffix ".staging"
        //versionNameSuffix "-staging"
        //signingConfig signingConfigs.config
    }
}

Проверьте эту ссылку для получения дополнительной информации

// Specifies two flavor dimensions.
flavorDimensions "tier", "minApi"

productFlavors {
     free {
            // Assigns this product flavor to the "tier" flavor dimension. Specifying
            // this property is optional if you are using only one dimension.
            dimension "tier"
            ...
     }

     paid {
            dimension "tier"
            ...
     }

     minApi23 {
            dimension "minApi"
            ...
     }

     minApi18 {
            dimension "minApi"
            ...
     }
}

Ответ 6

Если у вас есть простые варианты (бесплатный/профессиональный, демо/полный и т.д.), Добавьте его в файл build.gradle:

android {
...
flavorDimensions "version"
productFlavors {
        free{
            dimension "version"
            ...
            }
        pro{
            dimension "version"
            ...
            }
}

По размерам вы можете создавать "ароматы в ароматы". Читать дальше.