gradle在android studio的新版本中构建失败



我有gradle如何解决这个问题

failed: Build completed with 3 failed .

1: Task failed with an exception.

  • 哪里出错了:任务':app:mergeDebugJavaResource'执行失败。

无法解析配置':app:debugRuntimeClasspath'的所有文件。无法将sqlite-framework-2.1.0.jar (androidx.sqlite:sqlite-framework:2.1.0)转换为匹配属性{artifactType=android-java-res, org.gradle。类别=图书馆,org.gradle。org.gradle libraryelements = jar。状态=释放,org.gradle.usage = java运行时}。比;无法找到sqlite-framework-2.1.0.jar (androidx.sqlite:sqlite-framework:2.1.0)。可在以下地点搜索:https://dl.google.com/dl/android/maven2/androidx/sqlite/sqlite-framework/2.1.0/sqlite-framework-2.1.0.jar

  • 试题:使用——stacktrace选项运行以获取堆栈跟踪。使用——info或——debug选项运行以获得更多的日志输出。运行-scan以获得完整的见解。==============================================================================

2: Task failed with an exception.

  • 哪里出错了:任务':app: checkdebugduplicatecclasses '执行失败。

无法解析配置':app:debugRuntimeClasspath'的所有文件。无法将sqlite-framework-2.1.0.jar (androidx.sqlite:sqlite-framework:2.1.0)转换为匹配属性{artifactType=enumerated-runtime-classes, org.gradle。类别=图书馆,org.gradle。org.gradle libraryelements = jar。状态=释放,org.gradle.usage = java运行时}。比;无法找到sqlite-framework-2.1.0.jar (androidx.sqlite:sqlite-framework:2.1.0)。可在以下地点搜索:https://dl.google.com/dl/android/maven2/androidx/sqlite/sqlite-framework/2.1.0/sqlite-framework-2.1.0.jar

  • 试题:使用——stacktrace选项运行以获取堆栈跟踪。使用——info或——debug选项运行以获得更多的日志输出。运行-scan以获得完整的见解。==============================================================================

3: Task failed with an exception.

  • 哪里出错了:任务':app:mergeDebugNativeLibs'执行失败。

无法解析配置':app:debugRuntimeClasspath'的所有文件。无法将sqlite-framework-2.1.0.jar (androidx.sqlite:sqlite-framework:2.1.0)转换为匹配属性{artifactType=android-jni, org.gradle。类别=图书馆,org.gradle。org.gradle libraryelements = jar。状态=释放,org.gradle.usage = java运行时}。比;无法找到sqlite-framework-2.1.0.jar (androidx.sqlite:sqlite-framework:2.1.0)。可在以下地点搜索:https://dl.google.com/dl/android/maven2/androidx/sqlite/sqlite-framework/2.1.0/sqlite-framework-2.1.0.jar

  • 试题:使用——stacktrace选项运行以获取堆栈跟踪。使用——info或——debug选项运行以获得更多的日志输出。运行-scan以获得完整的见解。==============================================================================

  • 在https://help.gradle.org获取更多帮助

在此版本中使用了弃用的Gradle特性,使其与Gradle 8.0不兼容。

您可以使用'——warning-mode all'来显示单个弃用警告,并确定它们是否来自您自己的脚本或插件。

见https://docs.gradle.org/7.2/userguide/command_line_interface.html秒:command_line_warnings

建造在16秒内失败25个可执行任务:6个已执行,19个最新

enter code here
plugins {
id 'com.android.application'
id 'kotlin-android'
}
android {
compileSdk 31
defaultConfig {
applicationId "com.parsa.myapplication2"
minSdk 21
targetSdk 31
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
targetSdkVersion 30
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
compileSdkVersion 30
buildToolsVersion '30.0.2'
}
dependencies {
implementation 'androidx.core:core-ktx:1.6.0'
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.0'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
def koin_version="3.1.2"
implementation 'androidx.core:core-ktx:1.6.0'
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.0'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation "io.insert-koin:koin-android:$koin_version"
implementation "io.insert-koin:koin-android-compat:$koin_version"
implementation "io.insert-koin:koin-androidx-workmanager:$koin_version"
implementation "io.insert-koin:koin-androidx-compose:$koin_version"
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
implementation 'com.google.code.gson:gson:2.8.8'
implementation 'io.reactivex.rxjava2:rxjava:2.2.9'
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
implementation 'com.squareup.retrofit2:adapter-rxjava2:2.9.0'

def nav_version = "2.3.2"
implementation "androidx.navigation:navigation-fragment-ktx:$nav_version"
implementation "androidx.navigation:navigation-ui-ktx:$nav_version"
implementation "androidx.navigation:navigation-runtime-ktx:$nav_version"
implementation "androidx.viewpager2:viewpager2:1.0.0"
implementation 'com.facebook.fresco:fresco:2.5.0'
implementation 'com.tbuonomo:dotsindicator:4.2'
}

找到解决方案了。在构建中。在app文件夹中的gradle文件中,正如我所看到的,你没有为sqlite添加任何实现。删除旧的实现并添加以下内容:

implementation 'androidx.sqlite:sqlite-framework:2.2.0-alpha01'

最新更新