Skip to content Skip to sidebar Skip to footer

Android Studio 3.0 Canary 1 : Project Refresh Failed

I tried to load my project in this new Android Studio 3.0 Canary 1. It was running perfectly in my previous Android Studio Version 2.4 preview 7 This is the error I am facing: Erro

Solution 1:

Have a look at the migration tips: Use Flavor Dimensions for variant-aware dependency management

As it states:

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

Solution 2:

  flavorDimensions "mode"
productFlavors {
    dev {
        // Assigns this product flavor to the "mode" flavor dimension.
        dimension "mode"
        versionName "1.2"
        versionCode 02
    }
    uat {
        // Assigns this product flavor to the "mode" flavor dimension.
        dimension "mode"
        versionName "1.2"
        versionCode 2
    }
    live {
        // Assigns this product flavor to the "mode" flavor dimension.
        dimension "mode"
        versionName "1.0.1"
        versionCode 01
    }
}

This is working for me !! In your case you should just make a flavorDimensions variable and assign the value inside the dev block

flavorDimensions "anyvalue"

dev.initWith(buildTypes.debug)

    dev {
        dimension "anyvalue"
        applicationIdSuffix ".dev"
    }

This should help .

Post a Comment for "Android Studio 3.0 Canary 1 : Project Refresh Failed"