Error:Flavor 'fdroid' has no flavor dimension

问题: I am getting this error like Error: Flavor 'fdroid' has no flavor dimension. after importing the project into Android Studio, please help me I am not changing anything here...

问题:

I am getting this error like Error: Flavor 'fdroid' has no flavor dimension. after importing the project into Android Studio, please help me I am not changing anything here, it asking flavor dimensions of fdroid

I am getting this error like Error: Flavor 'fdroid' has no flavor dimension. after importing the project into Android Studio, please help me I am not changing anything here, it asking flavor dimensions of fdroid

    apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    buildToolsVersion "26.0.2"

    flavorDimensions "default"
    defaultConfig {
        applicationId "com.google.android.stardroid"
        minSdkVersion 15
        targetSdkVersion 24
        versionCode 1480
        versionName "1.9.2"
        buildConfigField 'String', 'GOOGLE_ANALYTICS_CODE', '""'
    }
    signingConfigs {
        release {
            if (project.file('no-checkin.properties').exists()) {
                Properties properties = new Properties()
                // Sky Map devs should create this file with the signing passwords
                properties.load(project.file('no-checkin.properties').newDataInputStream())
                storeFile file("stardroid-release-key.keystore")
                storePassword properties.getProperty('store-pwd')
                keyPassword properties.getProperty('key-pwd')
                keyAlias "stardroid"
            }
        }
    }
    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard.cfg'
            if (file('no-checkin.properties').exists()) {
                signingConfig signingConfigs.release
                Properties properties = new Properties()
                // Sky Map devs should create this file with the Google Analytics key
                properties.load(project.file('no-checkin.properties').newDataInputStream())
                def analyticsKey = properties.getProperty('analytics-key')
                buildConfigField 'String', 'GOOGLE_ANALYTICS_CODE', analyticsKey
            }
        }
    }

    lintOptions {
        // Lint complains because of missing translations.
        // TODO(jontayler): fix the missing translations.
        abortOnError false
    }

    // This enables long timeouts required on slow environments, e.g. Travis
    adbOptions {
        timeOutInMs 10 * 60 * 1000  // 10 minutes
        installOptions "-d", "-t"
    }

    productFlavors {
      // includes gms Google servies
      gms {
        resValue "string", "analytics_enabled", "true"
      }

      // uses only open source software
      fdroid {
        resValue "string", "analytics_enabled", "false"
      }
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.android.support:support-annotations:23.2.1'
    compile 'com.google.guava:guava:19.0'
    gmsCompile 'com.google.android.gms:play-services-analytics:8.4.0'
    gmsCompile 'com.google.android.gms:play-services-location:8.4.0'
    compile "com.android.support:support-v4:26.1.0"
    compile 'com.google.dagger:dagger:2.0.2'
    provided 'javax.annotation:jsr250-api:1.0'  // For annotations not in Android but needed by Dagger
    annotationProcessor 'com.google.dagger:dagger-compiler:2.0.2'
    testCompile 'junit:junit:4.12'
    testCompile 'org.mockito:mockito-core:1.10.19'
    testCompile 'org.robolectric:robolectric:3.0'
    androidTestCompile 'junit:junit:4.12'
    androidTestCompile 'org.easymock:easymock:2.5.2'
}

apply plugin: 'com.google.gms.google-services'

This is my app gradle please check it.


回答1:

You need to add dimension "tier" in your both flavor.

For more information, check the migration guide

Like :

    // 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"
        ...
    }
}
  • 发表于 2018-07-05 20:20
  • 阅读 ( 2516 )
  • 分类:sof

条评论

请先 登录 后评论
不写代码的码农
小编

篇文章

作家榜 »

  1. 小编 文章
返回顶部
部分文章转自于网络,若有侵权请联系我们删除