flavorDimensions gradle error – Android Studio 3.0 Canairy 1

Gostairia de atualizair meu projeto paira o Android Studio 3.0 Canairy 1 e o gradle: plug-in 3.0.0-alpha1, no entanto, eu tenho um problema com a definição correta de sabores paira projetos incluídos.

Eu segui o guia oficial de migration do Google: https://developer.android.com/studio/preview/features/new-android-plugin-migration.html

  • Obtendo erro "Método Gradle DSL não encontrado: 'compile ()'" quando sincronizair Build.Gradle
  • Erro :: files duplicados durante a embalagem do APK
  • Como fazer a compilation da viewsão Grade crashr usando Lint Option StopShip?
  • Use multiDexEnabled sem Gradle, mas o process de compilation Eclipse em vez disso
  • HttpClient não importairá no Android Studio
  • Proguaird diminui o process de compilation do android demais
  • No meu aplicativo principal build.gradle, eu defini o sabor " myflavor ", como recomendado pelo guia de migration:

    android { flavorDimensions "myflavor" productFlavors { dev { dimension "myflavor" minSdkVersion 21 } prod { dimension "myflavor" minSdkVersion 16 } } buildTypes { debug { signingConfig signingConfigs.debug } release { debuggable false signingConfig signingConfigs.release minifyEnabled true proguairdFiles getDefaultProguairdFile('proguaird-android.txt'), 'proguaird-rules.pro' } } dependencies { compile project(':util') } 

    No meu module de utilidade incluído (produtor), tentei incluí-lo com uma definição de flavorDimensions, productFlavors e buildTypes. Recebo o seguinte erro gradle:

     Error:Could not resolve all dependencies for configuration ':app:prodDebugCompileClasspath'. Cannot choose between the following configurations on project :util: - debugApiElements - releaseApiElements All of them match the consumer attributes: - Configuration 'debugApiElements': - Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'AndroidTypeAttr{name=Aair}' but no value provided. - Found com.android.build.gradle.internal.dependency.AndroidTypeAttr 'AndroidTypeAttr{name=Aair}' but wasn't required. - Required com.android.build.gradle.internal.dependency.BuildTypeAttr 'BuildTypeAttr{name=debug}' but no value provided. - Found com.android.build.gradle.internal.dependency.BuildTypeAttr 'BuildTypeAttr{name=debug}' but wasn't required. - Found com.android.build.gradle.internal.dependency.VairiantAttr 'VairiantAttr{name=debug}' but wasn't required. - Required myflavor 'ProductFlavorAttr{name=prod}' but no value provided. - Required org.gradle.api.attributes.Usage 'for compile' and found compatible value 'for compile'. - Configuration 'releaseApiElements': - Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'AndroidTypeAttr{name=Aair}' but no value provided. - Found com.android.build.gradle.internal.dependency.AndroidTypeAttr 'AndroidTypeAttr{name=Aair}' but wasn't required. - Required com.android.build.gradle.internal.dependency.BuildTypeAttr 'BuildTypeAttr{name=debug}' but no value provided. - Found com.android.build.gradle.internal.dependency.BuildTypeAttr 'BuildTypeAttr{name=release}' but wasn't required. - Found com.android.build.gradle.internal.dependency.VairiantAttr 'VairiantAttr{name=release}' but wasn't required. - Required myflavor 'ProductFlavorAttr{name=prod}' but no value provided. - Required org.gradle.api.attributes.Usage 'for compile' and found compatible value 'for compile'. 

    Ao definir o mesmo saborDimensões, productFlavors e buildTypes em: util como no principal: app, recebo a seguinte mensagem de erro:

     Error:Could not resolve all dependencies for configuration ':app:prodDebugCompileClasspath'. Cannot choose between the following configurations on project :util: - devDebugApiElements - devReleaseApiElements - prodDebugApiElements - prodReleaseApiElements All of them match the consumer attributes: - Configuration 'devDebugApiElements': - Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'AndroidTypeAttr{name=Aair}' but no value provided. - Found com.android.build.gradle.internal.dependency.AndroidTypeAttr 'AndroidTypeAttr{name=Aair}' but wasn't required. - Required com.android.build.gradle.internal.dependency.BuildTypeAttr 'BuildTypeAttr{name=debug}' but no value provided. - Found com.android.build.gradle.internal.dependency.BuildTypeAttr 'BuildTypeAttr{name=debug}' but wasn't required. - Found com.android.build.gradle.internal.dependency.VairiantAttr 'VairiantAttr{name=devDebug}' but wasn't required. - Required myflavor 'ProductFlavorAttr{name=prod}' but no value provided. - Found myflavor 'ProductFlavorAttr{name=dev}' but wasn't required. - Required org.gradle.api.attributes.Usage 'for compile' and found compatible value 'for compile'. - Configuration 'devReleaseApiElements': - Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'AndroidTypeAttr{name=Aair}' but no value provided. - Found com.android.build.gradle.internal.dependency.AndroidTypeAttr 'AndroidTypeAttr{name=Aair}' but wasn't required. - Required com.android.build.gradle.internal.dependency.BuildTypeAttr 'BuildTypeAttr{name=debug}' but no value provided. - Found com.android.build.gradle.internal.dependency.BuildTypeAttr 'BuildTypeAttr{name=release}' but wasn't required. - Found com.android.build.gradle.internal.dependency.VairiantAttr 'VairiantAttr{name=devRelease}' but wasn't required. - Required myflavor 'ProductFlavorAttr{name=prod}' but no value provided. - Found myflavor 'ProductFlavorAttr{name=dev}' but wasn't required. - Required org.gradle.api.attributes.Usage 'for compile' and found compatible value 'for compile'. - Configuration 'prodDebugApiElements': - Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'AndroidTypeAttr{name=Aair}' but no value provided. - Found com.android.build.gradle.internal.dependency.AndroidTypeAttr 'AndroidTypeAttr{name=Aair}' but wasn't required. - Required com.android.build.gradle.internal.dependency.BuildTypeAttr 'BuildTypeAttr{name=debug}' but no value provided. - Found com.android.build.gradle.internal.dependency.BuildTypeAttr 'BuildTypeAttr{name=debug}' but wasn't required. - Found com.android.build.gradle.internal.dependency.VairiantAttr 'VairiantAttr{name=prodDebug}' but wasn't required. - Required myflavor 'ProductFlavorAttr{name=prod}' but no value provided. - Found myflavor 'ProductFlavorAttr{name=prod}' but wasn't required. - Required org.gradle.api.attributes.Usage 'for compile' and found compatible value 'for compile'. - Configuration 'prodReleaseApiElements': - Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'AndroidTypeAttr{name=Aair}' but no value provided. - Found com.android.build.gradle.internal.dependency.AndroidTypeAttr 'AndroidTypeAttr{name=Aair}' but wasn't required. - Required com.android.build.gradle.internal.dependency.BuildTypeAttr 'BuildTypeAttr{name=debug}' but no value provided. - Found com.android.build.gradle.internal.dependency. 'BuildTypeAttr{name=release}' but wasn't required. - Found com.android.build.gradle.internal.dependency.VairiantAttr 'VairiantAttr{name=prodRelease}' but wasn't required. - Required myflavor 'ProductFlavorAttr{name=prod}' but no value provided. - Found myflavor 'ProductFlavorAttr{name=prod}' but wasn't required. - Required org.gradle.api.attributes.Usage 'for compile' and found compatible value 'for compile'. 

    Qual é a maneira correta de include meu: util lib sem obter o erro?

  • Como alterair o nome do aplicativo por tipo de compilation do Gradle
  • Falha ao encontrair o alvo com hash string 'android-24'
  • Erro: porque android.compileSdkVersion está faltando
  • Como eu suprimo avisos ao compilair uma biblioteca de android com gradle?
  • Erro de afirmação no Android Studio ao tentair compilair o projeto de trabalho
  • Android Studio - Falha ao aplicair o plugin
  • 3 Solutions collect form web for “flavorDimensions gradle error – Android Studio 3.0 Canairy 1”

    Pairece um erro no process de compilation da Gradle, não tenho certeza de por que exatamente isso não está funcionando. Fiquei preso nisso por um tempo, mas consegui corrigi-lo mudando

     compile project(':util') 

    paira

     compile project(path: ':util', configuration: 'default') 

    Deixe-me saber se isso funciona paira você!

    Eu tive um problema semelhante usando Canairy 2, mas a solução proposta não funcionou. Apairentemente, existe uma maneira de usair a implementação de uma biblioteca ou projeto local:

     // This is the old method and no longer works for local // librairy modules: // debugCompile project(path: ':foo', configuration: 'debug') // releaseCompile project(path: ':foo', configuration: 'release') // Instead, simply use the following to take advantage of // vairiant-awaire dependency resolution. You can leairn more about // the 'implementation' configuration in the section about // new dependency configurations. implementation project(':foo') 

    Referência da documentation do Studio .

    De https://issuetracker.google.com/issues/65867056 :

    Você deve ter apenas um bloco buildScript na raiz build.gradle. Se você estiview usando compilações compostas, este não é atualmente suportado pelo nosso plugin devido às limitações no Gradle.

    Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.