gpt4 book ai didi

android - 无法确定任务 ':app:lintVitalRelease' 的依赖关系。无法生成已签名的 APK

转载 作者:行者123 更新时间:2023-12-05 00:01:07 29 4
gpt4 key购买 nike

最近我在当前的 java 项目中添加了一些 kotlin Activity 和一个库项目。我可以毫无问题地运行项目。 clean - build - rebuild - run 一切正常。

生成签名 APK 时出现问题。我收到以下错误:

Could not determine the dependencies of task ':app:lintVitalRelease'.
> Could not resolve all artifacts for configuration ':app:buildCompileClasspath'.
> Could not resolve project :my_library.
Required by:
project :app
> No matching variant of project :my_library was found. The consumer was configured to find an API of a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'build', attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm' but:
- Variant 'debugApiElements' capability My_project:my_library:unspecified declares an API of a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm':
- Incompatible because this component declares a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debug' and the consumer needed a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'build'
- Variant 'debugRuntimeElements' capability My_project:my_library:unspecified declares a runtime of a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm':
- Incompatible because this component declares a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debug' and the consumer needed a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'build'
- Variant 'debugTestApiElements' capability My_project:my_library:unspecified declares an API of a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm':
- Incompatible because this component declares a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debugTest' and the consumer needed a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'build'
- Variant 'debugTestRuntimeElements' capability My_project:my_library:unspecified declares a runtime of a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm':
- Incompatible because this component declares a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debugTest' and the consumer needed a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'build'
- Variant 'releaseApiElements' capability My_project:my_library:unspecified declares an API of a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm':
- Incompatible because this component declares a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'release' and the consumer needed a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'build'
- Variant 'releaseRuntimeElements' capability My_project:my_library:unspecified declares a runtime of a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm':
- Incompatible because this component declares a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'release' and the consumer needed a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'build'


gradle file in project level :

buildscript {
ext.kotlin_version = '1.5.0'
ext {
projectMinSdkVersion = 16 // 15 android 4.0.3 for release
projectTargetSdkVersion = 30 //23 requires permission requests , 22 for release
}
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.3'
// classpath 'com.android.tools.build:gradle:4.2.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// classpath 'com.google.gms:google-services:4.3.4'//
classpath 'com.google.gms:google-services:4.3.10'//
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.7.1' //
}

}
//plugins {
// id 'nebula.lint' version '9.3.4'
//}
allprojects {
repositories {
google()
jcenter()
maven { url "https://jitpack.io" }
// maven {
// url "https://maven.google.com" // Google's Maven repository
// }
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:deprecation"
}

}
}

task clean(type: Delete) {
delete rootProject.buildDir
}

库级别的插件:

    apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

应用级别的插件:

    apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

有什么想法吗?

最佳答案

感谢 @Fabio,我找到了解决方案.问题出在 buildTypes 结构中。所以,在应用级别我有 releasebuild,但在库级别我有 releasedebug

我将库级别的 buildTypes 更改为与应用级别相同:

buildTypes {
release {
// minifyEnabled false
// proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}

build {
// minifyEnabled false
// proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}

因此,如果需要,我建议从每个构建中的应用程序级别和注释行复制它。

关于android - 无法确定任务 ':app:lintVitalRelease' 的依赖关系。无法生成已签名的 APK,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69354035/

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