我有一个颤振应用程序。一切都工作正常,直到我包含了social_share包,它开始崩溃,有趣的是,它开始在以前没有问题的包中崩溃。现在每当我尝试在 Android 上运行时,我都会遇到这个问题
Execution failed for task ':audioplayers_android:compileDebugJavaWithJavac'.
> Error while evaluating property 'javaCompiler' of task ':audioplayers_android:compileDebugJavaWithJavac'.
> Failed to calculate the value of task ':audioplayers_android:compileDebugJavaWithJavac' property 'javaCompiler'.
> No matching toolchains found for requested specification: {languageVersion=8, vendor=any, implementation=vendor-specific}.
> No locally installed toolchains match (see https://docs.gradle.org/8.0/userguide/toolchains.html#sec:auto_detection) and toolchain download repositories have not been configured (see https://docs.gradle.org/8.0/userguide/toolchains.html#sub:download_repositories).
这是我的项目级build.gradle
buildscript {
ext.kotlin_version = '1.9.21'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.3.0'
// START: FlutterFire Configuration
classpath 'com.google.gms:google-services:4.4.0'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.8.1'
// END: FlutterFire Configuration
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
plugins {
// Apply the java plugin to add support for Java
id 'java'
}
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(8))
}
}
allprojects {
repositories {
google()
mavenCentral()
}
tasks.withType(JavaCompile) {
javaCompiler = javaToolchains.compilerFor {
languageVersion.set(JavaLanguageVersion.of(8))
}
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
这是一个应用程序级别的build.gradle
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
apply plugin: 'com.android.application'
// START: FlutterFire Configuration
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'
// END: FlutterFire Configuration
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
compileSdkVersion 34 //localProperties.getProperty("flutter.compileSdkVersion")
ndkVersion flutter.ndkVersion
compileOptions {
sourceCompatibility 1.8
targetCompatibility 1.8
}
kotlinOptions {
jvmTarget = '1.8'
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
defaultConfig {
applicationId "com.rlabs.wordera"
minSdkVersion 21
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
multiDexEnabled true
}
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
release {
signingConfig signingConfigs.release
}
}
}
flutter {
source '../..'
}
dependencies {
implementation 'androidx.multidex:multidex:2.0.1'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
// Import the BoM for the Firebase platform
implementation(platform("com.google.firebase:firebase-bom:32.7.0"))
// Add the dependency for the Firebase Authentication library
// When using the BoM, you don't specify versions in Firebase library dependencies
implementation("com.google.firebase:firebase-auth")
// Also add the dependency for the Google Play services library and specify its version
implementation("com.google.android.gms:play-services-auth:20.7.0")
}
我重新安装了java,Android Studio,我问了chat-gpt,codepilot和bard,没有任何帮助哈哈。这是什么问题?
我遇到了类似的问题,并且能够通过将 foojay 工具链添加到我的 settings.gradle 文件中的
plugins
部分下来解决它:
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.8.0'