ترقية إلى Studio Canary build. مشروعي السابق لبرنامج Telegram Messenger يقدم الخطأ التالي.
خطأ: يجب أن تنتمي جميع النكهات الآن إلى بُعد نكهة معين. لم يتم تعيين نكهة "armv7" لبعد نكهة. تعرف على المزيد على https://d.Android.com/r/tools/flavorDimensions-missing-error-message.html
ماذا يجب أن أفعل؟ لقد رأيت بالفعل هذا الرابط ولكني لم أستطع فهم ما يجب القيام به. لدي 3 بناء المتغيرات الآن ، والإفراج ، والتصحيح وفوس.
إذا لم تكن في حاجة إلى الآلية ، فما عليك سوى تحديد بُعد نكهة عشوائي في build.gradle
:
Android {
...
flavorDimensions "default"
...
}
لمزيد من المعلومات ، راجع دليل الترحيل
بعد المحاولة والقراءة بعناية ، قمت بحلها بنفسي. الحل هو إضافة السطر التالي في build.gradle.
نكهةالأبعاد "versionCode"
Android {
compileSdkVersion 24
.....
flavorDimensions "versionCode"
}
هنا يمكنك حل هذه المشكلة ، تحتاج إلى إضافة نكهة البعد مع اسم productFlavors وتحتاج إلى تحديد البعد كذلك ، انظر المثال أدناه ولمزيد من المعلومات انظر هنا https://developer.Android.com/ studio/build/gradle-plugin-3-0-0-migration.html
flavorDimensions 'free','paid' //here defined dimensions
productFlavors {
production {
dimension 'paid' //you just need to add this line
... // your existing code
}
demo {
dimension 'free' //added here also
... // your existing code
}
development {
dimension 'free' //add here too
... // your existing code
}
إذا كنت تريد عدم استخدام الأبعاد ، يجب عليك استخدام هذا الخط
Android {
compileSdkVersion 24
...
flavorDimensions "default"
...
}
ولكن إذا كنت تريد استخدام ti ، فيجب عليك إعلان اسم البعد أولاً ثم استخدام هذا الاسم بعد هذا المثال من الوثائق:
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"
...
}
}
}
...
لقد استخدمت flavorDimensions لتطبيقي في 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"
...
}
}