[英]Android Studio Flavor Dimension Issue
It's my first encounter with flavor dimensions.这是我第一次接触风味维度。 I am trying to compile a ready-made code but somehow I ended up with this issue.我正在尝试编译一个现成的代码,但不知何故我最终遇到了这个问题。
ERROR: All flavors must now belong to a named flavor dimension.错误:所有风味现在都必须属于命名风味维度。 Learn more at https://d.android.com/r/tools/flavorDimensions-missing-error-message.html Affected Modules: app在https://d.android.com/r/tools/flavorDimensions-missing-error-message.html受影响的模块:应用程序中了解更多信息
I sorry for being a noob and really don't know how to solve this.我很抱歉是个菜鸟,真的不知道如何解决这个问题。 If someone had a solution please help me with this.如果有人有解决方案,请帮我解决这个问题。
How to fix this?如何解决这个问题?
Here is my build.gradle file这是我的 build.gradle 文件
apply plugin: 'com.android.application'
android {
configurations.all {
resolutionStrategy.force 'com.google.code.findbugs:jsr305:1.3.9'
}
compileSdkVersion 28
buildToolsVersion "28.0.3"strong text
defaultConfig {
minSdkVersion 16
targetSdkVersion 28
manifestPlaceholders = [appPackageName: "${applicationId}"]
multiDexEnabled true
}
dexOptions {
jumboMode true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
pixol {
applicationId "com.dslr.camera.pixol"
//Package name change it before uploading to store
resValue "string", "app_name", "Pixol" //app name change it before uploading to store
resValue "string", "dev_name", "" // Google play developer name
resValue "string", "facebook_app_id", "" //facebook app id (get it from facebook sdk see the dcumentation)
//admob
resValue "string", "main_full", "YOUR_ADMOB_AD_UNIT_HERE"// admob interstitial ad 1
resValue "string", "result_full", "YOUR_ADMOB_AD_UNIT_HERE" // admob interstitial ad 2
resValue "string", "main_native", "YOUR_ADMOB_AD_UNIT_HERE" // admob naive large tamplate
resValue "string", "result_native", "YOUR_ADMOB_AD_UNIT_HERE" // admob naive large tamplate
//audience network
resValue "string", "main_full_fb", "YOUR_FACEBOOK_AD_UNIT_HERE"// fb ad interstitial ad 1
resValue "string", "result_full_fb", "YOUR_FACEBOOK_AD_UNIT_HERE"// fb ad interstitial ad 2
manifestPlaceholders = [appIcon: "@mipmap/ic_launcher"] // app icon change in mipmap folder
versionCode 2
versionName "1"
}
}
/* 3) Exclude duplicate licenses */
packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/DEPENDENCIES'
pickFirst 'AndroidManifest.xml'
exclude 'META-INF/rxjava.properties'
}
}
dependencies {
/* compile fileTree(include: ['*.jar'], dir: 'libs')
*//* 4) Add the CSDK framework dependencies (Make sure these version numbers are correct) *//*
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.mlsdev.rximagepicker:library:2.0.0'
compile 'com.adobe.creativesdk.foundation:auth:0.9.1251'
compile 'com.adobe.creativesdk:image:4.8.4'
compile 'com.localytics.android:library:3.8.0'
compile 'com.github.medyo:fancybuttons:1.8.3'
compile 'com.jakewharton:butterknife:7.0.1'
compile 'com.android.support:multidex:1.0.0'
compile 'com.facebook.android:facebook-android-sdk:[4,5)'
compile 'com.facebook.android:audience-network-sdk:4.+'
compile 'com.google.android.gms:play-services-ads:10.2.1'
compile 'com.cocosw:bottomsheet:1.+@aar'*/
}
You need to provide a flavorDimension
to each flavor.您需要为每种风味提供一个风味flavorDimension
。
Here is Changes you need to do:这是您需要做的更改:
apply plugin: 'com.android.application'
android {
configurations.all {
resolutionStrategy.force 'com.google.code.findbugs:jsr305:1.3.9'
}
compileSdkVersion 28
buildToolsVersion "28.0.3"strong text
defaultConfig {
minSdkVersion 16
targetSdkVersion 28
manifestPlaceholders = [appPackageName: "${applicationId}"]
multiDexEnabled true
}
dexOptions {
jumboMode true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
flavorDimensions "version"
productFlavors {
pixol {
dimension "version"
applicationId "com.dslr.camera.pixol"
//Package name change it before uploading to store
resValue "string", "app_name", "Pixol" //app name change it before uploading to store
resValue "string", "dev_name", "" // Google play developer name
resValue "string", "facebook_app_id", "" //facebook app id (get it from facebook sdk see the dcumentation)
//admob
resValue "string", "main_full", "YOUR_ADMOB_AD_UNIT_HERE"// admob interstitial ad 1
resValue "string", "result_full", "YOUR_ADMOB_AD_UNIT_HERE" // admob interstitial ad 2
resValue "string", "main_native", "YOUR_ADMOB_AD_UNIT_HERE" // admob naive large tamplate
resValue "string", "result_native", "YOUR_ADMOB_AD_UNIT_HERE" // admob naive large tamplate
//audience network
resValue "string", "main_full_fb", "YOUR_FACEBOOK_AD_UNIT_HERE"// fb ad interstitial ad 1
resValue "string", "result_full_fb", "YOUR_FACEBOOK_AD_UNIT_HERE"// fb ad interstitial ad 2
manifestPlaceholders = [appIcon: "@mipmap/ic_launcher"] // app icon change in mipmap folder
versionCode 2
versionName "1"
}
}
/* 3) Exclude duplicate licenses */
packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/DEPENDENCIES'
pickFirst 'AndroidManifest.xml'
exclude 'META-INF/rxjava.properties'
}
}
dependencies {
/* compile fileTree(include: ['*.jar'], dir: 'libs')
*//* 4) Add the CSDK framework dependencies (Make sure these version numbers are correct) *//*
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.mlsdev.rximagepicker:library:2.0.0'
compile 'com.adobe.creativesdk.foundation:auth:0.9.1251'
compile 'com.adobe.creativesdk:image:4.8.4'
compile 'com.localytics.android:library:3.8.0'
compile 'com.github.medyo:fancybuttons:1.8.3'
compile 'com.jakewharton:butterknife:7.0.1'
compile 'com.android.support:multidex:1.0.0'
compile 'com.facebook.android:facebook-android-sdk:[4,5)'
compile 'com.facebook.android:audience-network-sdk:4.+'
compile 'com.google.android.gms:play-services-ads:10.2.1'
compile 'com.cocosw:bottomsheet:1.+@aar'*/
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.