首页 > 解决方案 > 错误:风味“fdroid”没有风味维度

问题描述

我收到类似错误的错误:风味'fdroid'没有风味维度。将项目导入 Android Studio 后,请帮帮我我这里没有改变任何东西,它询问 fdroid 的风味尺寸

我收到类似错误的错误:风味'fdroid'没有风味维度。将项目导入 Android Studio 后,请帮帮我我这里没有改变任何东西,它询问 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'

这是我的应用程序,请检查它。

标签: androidandroid-flavordimension

解决方案


你需要添加dimension "tier"你的两种口味。

有关更多信息,请查看迁移指南

喜欢 :

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

推荐阅读