错误:风味'fdroid'没有风味尺寸

时间:2018-07-04 05:40:10

标签: android android-flavordimension

我遇到类似错误的错误:风味'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'

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

1 个答案:

答案 0 :(得分:1)

您需要同时添加两种口味的dimension "tier"

有关更多信息,请检查migration guide

赞:

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