Learn more at https://d.android.com

Because I gradle version build.gradle in the main program into this, specify which version I do not know, so he wrote a 3.0+
 the Dependencies {
        the CLASSPATH 'com.android.tools.build:gradle:3.0+ ' 
}
then compile again, and found drugs.
Tip: Error: All Flavors now belong to the MUST flavors the dimension.Learn More A named AT  https://d.android.com/r/tools/flavorDimensions-missing-error-message.html 
this a mistake, meaning: all flavors must belong to the same style.
=. = Ignorant forced
to read the address *** it offers to know:
 Plugin 3.0.0 includes a new dependency mechanism that automatically matches variants when consuming a library. This means an app's debug variant automatically consumes a library's debug variant, and so on. It also works when using flavors—an app's redDebug variant will consume a library's redDebug variant. To make this work, the plugin now requires that all flavors belong to a named flavor dimension —even if you intend to use only a single dimension. Otherwise, you will get the following build error:
Error:All flavors must now belong to a named flavor dimension.
The flavor 'flavor_name' is not assigned to a flavor dimension.

 To resolve this error, assign each flavor to a named dimension, as shown in the sample below. Because dependency matching is now taken care of by the plugin, you should name your flavor dimensions carefully. For example, if all your app and library modules use the foo dimension, you'll have less control over which flavors are matched by the plugin. 
// Specifies a flavor dimension.
flavorDimensions "color"

productFlavors {
red {
// Assigns this product flavor to the 'color' flavor dimension.
// This step is optional if you are using only one dimension.
dimension "color"
...
}

blue {
  dimension "color"
  ...
}

}

Generally is said to have consumed a mechanism for automatic matching library after Plugin 3.0.0, easy to debug variant automatically consume a library, then all the flavor is the need to belong to the same dimension.
To avoid problems of different flavor error foo should use the same size in all the library modules.
=. = Still ignorant force. He said pile still do not quite understand.
But we already know from the solutions:
in build.gradle inside the main app
 defaultConfig {
 targetSdkVersion:
minSdkVersion:

versionCode:
 versionName:

// add a version name behind a word, it means that the flavor dimension is the dimension of the version number, so dimensions are unified is the
flavorDimensions "versionCode"
}

Directly address this issue. Then the app will be happy to run up

Guess you like

Origin blog.51cto.com/11585002/2450908