gpt4 book ai didi

Android buildTypes 与 productFlavors 错误

转载 作者:行者123 更新时间:2023-12-03 13:26:46 26 4
gpt4 key购买 nike

决定使用 Gradle 6.5 从 Android gradle plugin 3.5.x 切换到 gradle plugin 4.10 并坚持错误。
这是我的 build.gradle

defaultConfig {

applicationId "com.example.myapp
targetSdkVersion targetSdkVersionVar
multiDexEnabled true
}

flavorDimensions "version"

productFlavors {
kitkat {
sourceSets { "src/android/kitkat" }
dimension "version"
minSdkVersion minSdkKitkat
targetSdkVersion targetSdkKitkat
versionNameSuffix "-kitkat"
}
nougat {
sourceSets { "src/android/nougat" }
dimension "version"
minSdkVersion minSdkNougat
targetSdkVersion targetSdkVersionVar
versionNameSuffix "-nougat"
}
}


buildTypes {

debug {
multiDexKeepFile file('multidex-config.txt')
multiDexKeepProguard file('multidex-config.pro')
minifyEnabled false
zipAlignEnabled true
sourceSets {

//main.java.srcDirs += 'src/main/kotlin'
main {
java.srcDirs = ['src/android/default/java/', 'src/common/java/']
jni.srcDirs = [] //disable ndk support
manifest.srcFile 'src/android/default/AndroidManifest.xml'
resources.srcDirs = ['src/android/default']
aidl.srcDirs = ['src/android/default']
renderscript.srcDirs = ['src/android/default']
res.srcDirs = ['src/android/default/res']
assets.srcDirs = ['src/android/default/assets']
}
test {
java.srcDirs = ['src/test/java']
}
androidTest {
java.srcDirs = ['src/androidTest/java']
}
}
}
release {
multiDexKeepFile file('multidex-config.txt')
multiDexKeepProguard file('multidex-config.pro')
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
zipAlignEnabled true
sourceSets {

main {
java.srcDirs = ['src/android/default/java/', 'src/common/java/']
jni.srcDirs = [] //disable ndk support
manifest.srcFile 'src/android/default/AndroidManifest.xml'
resources.srcDirs = ['src/android/default']
aidl.srcDirs = ['src/android/default']
renderscript.srcDirs = ['src/android/default']
res.srcDirs = ['src/android/default/res']
assets.srcDirs = ['src/android/default/assets']
}
test {
java.srcDirs = ['src/test/java']
}
androidTest {
java.srcDirs = ['src/androidTest/java']
}
}
}
}
尝试构建我收到以下错误消息:
Could not determine the dependencies of task ':app:checkKitkatReleaseLibraries'.
> Could not resolve all task dependencies for configuration ':app:kitkatReleaseReverseMetadataValues'.
> Could not resolve project :app.
Required by:
project :app
> The consumer was configured to find a usage of 'android-reverse-meta-data' of a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'release', attribute 'version' with value 'kitkat'. However we cannot choose between the following variants of project :app:
- kitkatDebugAndroidTestCompile
- kitkatDebugAndroidTestRuntime
- kitkatDebugRuntime
- kitkatDebugUnitTestCompile
- kitkatDebugUnitTestRuntime
- kitkatReleaseRuntime
- kitkatReleaseUnitTestCompile
- kitkatReleaseUnitTestRuntime
- nougatDebugAndroidTestCompile
- nougatDebugAndroidTestRuntime
- nougatDebugRuntime
- nougatDebugUnitTestCompile
- nougatDebugUnitTestRuntime
- nougatReleaseRuntime
- nougatReleaseUnitTestCompile
- nougatReleaseUnitTestRuntime
All of them match the consumer attributes:
- Variant 'kitkatDebugAndroidTestCompile' capability myapp:app:unspecified:
- Unmatched attributes:
- Doesn't say anything about com.android.build.api.attributes.BuildTypeAttr (required 'release')
- Doesn't say anything about its usage (required a usage of 'android-reverse-meta-data')
- Provides attribute 'org.jetbrains.kotlin.localToProject' with value 'local to :app' but the consumer didn't ask for it
- Provides attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm' but the consumer didn't ask for it
- Doesn't say anything about version (required 'kitkat')
- Variant 'kitkatDebugAndroidTestRuntime' capability myapp:app:unspecified:
- Unmatched attributes:
- Doesn't say anything about com.android.build.api.attributes.BuildTypeAttr (required 'release')
- Doesn't say anything about its usage (required a usage of 'android-reverse-meta-data')
- Provides attribute 'org.jetbrains.kotlin.localToProject' with value 'local to :app' but the consumer didn't ask for it
- Provides attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm' but the consumer didn't ask for it
- Doesn't say anything about version (required 'kitkat')
- Variant 'kitkatDebugRuntime' capability myapp:app:unspecified:
- Unmatched attributes:
- Doesn't say anything about com.android.build.api.attributes.BuildTypeAttr (required 'release')
- Doesn't say anything about its usage (required a usage of 'android-reverse-meta-data')
- Provides attribute 'org.jetbrains.kotlin.localToProject' with value 'local to :app' but the consumer didn't ask for it
- Provides attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm' but the consumer didn't ask for it
- Doesn't say anything about version (required 'kitkat')
- Variant 'kitkatDebugUnitTestCompile' capability myapp:app:unspecified:
- Unmatched attributes:
- Doesn't say anything about com.android.build.api.attributes.BuildTypeAttr (required 'release')
- Doesn't say anything about its usage (required a usage of 'android-reverse-meta-data')
- Provides attribute 'org.jetbrains.kotlin.localToProject' with value 'local to :app' but the consumer didn't ask for it
- Provides attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm' but the consumer didn't ask for it
- Doesn't say anything about version (required 'kitkat')
- Variant 'kitkatDebugUnitTestRuntime' capability myapp:app:unspecified:
- Unmatched attributes:
- Doesn't say anything about com.android.build.api.attributes.BuildTypeAttr (required 'release')
- Doesn't say anything about its usage (required a usage of 'android-reverse-meta-data')
- Provides attribute 'org.jetbrains.kotlin.localToProject' with value 'local to :app' but the consumer didn't ask for it
- Provides attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm' but the consumer didn't ask for it
- Doesn't say anything about version (required 'kitkat')
- Variant 'kitkatReleaseRuntime' capability myapp:app:unspecified:
- Unmatched attributes:
- Doesn't say anything about com.android.build.api.attributes.BuildTypeAttr (required 'release')
- Doesn't say anything about its usage (required a usage of 'android-reverse-meta-data')
- Provides attribute 'org.jetbrains.kotlin.localToProject' with value 'local to :app' but the consumer didn't ask for it
- Provides attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm' but the consumer didn't ask for it
- Doesn't say anything about version (required 'kitkat')
- Variant 'kitkatReleaseUnitTestCompile' capability myapp:app:unspecified:
- Unmatched attributes:
- Doesn't say anything about com.android.build.api.attributes.BuildTypeAttr (required 'release')
- Doesn't say anything about its usage (required a usage of 'android-reverse-meta-data')
- Provides attribute 'org.jetbrains.kotlin.localToProject' with value 'local to :app' but the consumer didn't ask for it
- Provides attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm' but the consumer didn't ask for it
- Doesn't say anything about version (required 'kitkat')
- Variant 'kitkatReleaseUnitTestRuntime' capability myapp:app:unspecified:
- Unmatched attributes:
- Doesn't say anything about com.android.build.api.attributes.BuildTypeAttr (required 'release')
- Doesn't say anything about its usage (required a usage of 'android-reverse-meta-data')
- Provides attribute 'org.jetbrains.kotlin.localToProject' with value 'local to :app' but the consumer didn't ask for it
- Provides attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm' but the consumer didn't ask for it
- Doesn't say anything about version (required 'kitkat')
- Variant 'nougatDebugAndroidTestCompile' capability myapp:app:unspecified:
- Unmatched attributes:
- Doesn't say anything about com.android.build.api.attributes.BuildTypeAttr (required 'release')
- Doesn't say anything about its usage (required a usage of 'android-reverse-meta-data')
- Provides attribute 'org.jetbrains.kotlin.localToProject' with value 'local to :app' but the consumer didn't ask for it
- Provides attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm' but the consumer didn't ask for it
- Doesn't say anything about version (required 'kitkat')
- Variant 'nougatDebugAndroidTestRuntime' capability myapp:app:unspecified:
- Unmatched attributes:
- Doesn't say anything about com.android.build.api.attributes.BuildTypeAttr (required 'release')
- Doesn't say anything about its usage (required a usage of 'android-reverse-meta-data')
- Provides attribute 'org.jetbrains.kotlin.localToProject' with value 'local to :app' but the consumer didn't ask for it
- Provides attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm' but the consumer didn't ask for it
- Doesn't say anything about version (required 'kitkat')
- Variant 'nougatDebugRuntime' capability myapp:app:unspecified:
- Unmatched attributes:
- Doesn't say anything about com.android.build.api.attributes.BuildTypeAttr (required 'release')
- Doesn't say anything about its usage (required a usage of 'android-reverse-meta-data')
- Provides attribute 'org.jetbrains.kotlin.localToProject' with value 'local to :app' but the consumer didn't ask for it
- Provides attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm' but the consumer didn't ask for it
- Doesn't say anything about version (required 'kitkat')
- Variant 'nougatDebugUnitTestCompile' capability myapp:app:unspecified:
- Unmatched attributes:
- Doesn't say anything about com.android.build.api.attributes.BuildTypeAttr (required 'release')
- Doesn't say anything about its usage (required a usage of 'android-reverse-meta-data')
- Provides attribute 'org.jetbrains.kotlin.localToProject' with value 'local to :app' but the consumer didn't ask for it
- Provides attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm' but the consumer didn't ask for it
- Doesn't say anything about version (required 'kitkat')
- Variant 'nougatDebugUnitTestRuntime' capability myapp:app:unspecified:
- Unmatched attributes:
- Doesn't say anything about com.android.build.api.attributes.BuildTypeAttr (required 'release')
- Doesn't say anything about its usage (required a usage of 'android-reverse-meta-data')
- Provides attribute 'org.jetbrains.kotlin.localToProject' with value 'local to :app' but the consumer didn't ask for it
- Provides attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm' but the consumer didn't ask for it
- Doesn't say anything about version (required 'kitkat')
- Variant 'nougatReleaseRuntime' capability myapp:app:unspecified:
- Unmatched attributes:
- Doesn't say anything about com.android.build.api.attributes.BuildTypeAttr (required 'release')
- Doesn't say anything about its usage (required a usage of 'android-reverse-meta-data')
- Provides attribute 'org.jetbrains.kotlin.localToProject' with value 'local to :app' but the consumer didn't ask for it
- Provides attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm' but the consumer didn't ask for it
- Doesn't say anything about version (required 'kitkat')
- Variant 'nougatReleaseUnitTestCompile' capability myapp:app:unspecified:
- Unmatched attributes:
- Doesn't say anything about com.android.build.api.attributes.BuildTypeAttr (required 'release')
- Doesn't say anything about its usage (required a usage of 'android-reverse-meta-data')
- Provides attribute 'org.jetbrains.kotlin.localToProject' with value 'local to :app' but the consumer didn't ask for it
- Provides attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm' but the consumer didn't ask for it
- Doesn't say anything about version (required 'kitkat')
- Variant 'nougatReleaseUnitTestRuntime' capability myapp:app:unspecified:
- Unmatched attributes:
- Doesn't say anything about com.android.build.api.attributes.BuildTypeAttr (required 'release')
- Doesn't say anything about its usage (required a usage of 'android-reverse-meta-data')
- Provides attribute 'org.jetbrains.kotlin.localToProject' with value 'local to :app' but the consumer didn't ask for it
- Provides attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm' but the consumer didn't ask for it
- Doesn't say anything about version (required 'kitkat')
The following variants were also considered but didn't match the requested attributes:
- Variant 'kitkatDebugApiElements' capability myapp:app:unspecified declares a component, as well as attribute 'version' with value 'kitkat':
- Incompatible because this component declares an API of a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debug' and the consumer needed a usage of 'android-reverse-meta-data' of a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'release'
- Variant 'kitkatDebugRuntimeElements' capability myapp:app:unspecified declares a component, as well as attribute 'version' with value 'kitkat':
- Incompatible because this component declares a runtime of a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debug' and the consumer needed a usage of 'android-reverse-meta-data' of a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'release'
- Variant 'kitkatReleaseApiElements' capability myapp:app:unspecified declares a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'release', attribute 'version' with value 'kitkat':
- Incompatible because this component declares an API of a component and the consumer needed a usage of 'android-reverse-meta-data' of a component
- Variant 'kitkatReleaseRuntimeElements' capability myapp:app:unspecified declares a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'release', attribute 'version' with value 'kitkat':
- Incompatible because this component declares a runtime of a component and the consumer needed a usage of 'android-reverse-meta-data' of a component
- Variant 'nougatDebugApiElements' capability myapp:app:unspecified:
- Incompatible because this component declares an API of a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debug', attribute 'version' with value 'nougat' and the consumer needed a usage of 'android-reverse-meta-data' of a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'release', attribute 'version' with value 'kitkat'
- Variant 'nougatDebugRuntimeElements' capability myapp:app:unspecified:
- Incompatible because this component declares a runtime of a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debug', attribute 'version' with value 'nougat' and the consumer needed a usage of 'android-reverse-meta-data' of a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'release', attribute 'version' with value 'kitkat'
- Variant 'nougatReleaseApiElements' capability myapp:app:unspecified declares a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'release':
- Incompatible because this component declares an API of a component, as well as attribute 'version' with value 'nougat' and the consumer needed a usage of 'android-reverse-meta-data' of a component, as well as attribute 'version' with value 'kitkat'
- Variant 'nougatReleaseRuntimeElements' capability myapp:app:unspecified declares a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'release':
- Incompatible because this component declares a runtime of a component, as well as attribute 'version' with value 'nougat' and the consumer needed a usage of 'android-reverse-meta-data' of a component, as well as attribute 'version' with value 'kitkat'
在此之前,当我使用 gradle-tools v 3.x 时,它工作得非常好。
有什么想法、想法、提示、线索吗?

最佳答案

您遇到的问题似乎是您的主项目使用具有 flavor 维度的库,而您的应用程序不知道要使用哪一个。您应该使用 缺少维度策略默认配置 block 以指定默认 flavor 。例如 :

missingDimensionStrategy 'dimension', 'flavor1', 'flavor2'
请查看 this链接了解更多详情。

关于Android buildTypes 与 productFlavors 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64758477/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com