2017-05-22 56 views
134

Studio Canary build'e yükseltildi. Telegram Messenger'ın önceki projem şu hatayı veriyor.Android Studio 3.0 Lezzet Boyut Sorun

Error:All flavors must now belong to a named flavor dimension. The flavor 'armv7' is not assigned to a flavor dimension. Learn more at https://d.android.com/r/tools/flavorDimensions-missing-error-message.html

Ne yapmalıyım? Bu bağlantıyı daha önce görmüştüm ama ne yapacağımı anlayamadım. Şimdi 3 tane varyant var, sürüm, hata ayıklama ve foss.

cevap

307

gerçekten mekanizmasını gerekmiyorsa, rasgele lezzet boyutu belirtin:

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

fazla bilgi için, çalışırken ve dikkatle okuduktan sonra migration guide

+0

Teşekkür bakın. Zaten "versionCode" boyutuna sahiptim, bunu kullandım. –

+2

flavorDimensions "versionCode" productFlavors { ayıklama { boyut "varsayılan" versionName "1.0" } bırakma { boyut "varsayılan" versionName "1.0" } Foss { boyut "varsayılan" versionName "1.0" } } Bu hatayı aldım .. ProductFlavor adları BuildType adları ile çarpışamaz. Birinin bana yardım etmesini ister misiniz? Kotlin ile AS 3.0 beta sürümü Canary bu hatayı aldım. –

+0

Eğer build.gradle'mın herhangi bir yerinde lezzet kullanmamışsam ne yapmalıyım? 2 buildTypes, debug ve release var. – mDroidd

46

kontrol, kendim çözdüm. Çözüm, aşağıdaki satırı build.gradle içine eklemektir.

flavorDimensions "versionCode"

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

Burada bu satırı ekliyor musunuz?Biraz daha fazla bağlam yararlı olabilir –

+2

Inside build.gradle dosyası, android içinde {...} –

+0

android { compileSdkVersion 24 .... // buraya ekleyin} –

9

Eğer

android { 
compileSdkVersion 24 

... 
flavorDimensions "default" 
... 
} 

bu satırı kullanmalısınız ancak ti kullanım boyutlarını istiyorsanız öncelikle boyut adını ilan edip sonra sonra bu adı kullanmak gerektiğini boyutlarını kullanmamayı istiyorsanız Bu örnek, şu belgelerde yer almaktadır:

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" 
    ... 
    } 
    } 
} 
... 
4

Ben flavorDimens kullandım build.gradle benim uygulama için iyonlar (Modül: app)

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 
    } 
} 
İşte

Check this link for more info

// 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" 
      ... 
    } 
} 
5

bu sorunu çözebilir, sen productFlavors adıyla flavorDimension eklemem gerekiyor gibi bir boyut tanımlamak gerekir iyi örnek aşağıya bakın ve daha fazla bilgi için burayahttps://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 

    }