Mein Flutter -Projekt funktionierte einwandfrei, aber als ich die Shared_Preferences Plugin zum Implementieren von Token -Speicher hinzufügte, fehlgeschlagen das Build unmittelbar nach dem Hinzufügen der Abhängigkeit (ohne das Schreiben eines Codes). führte zu einem Gradle Build fehlgeschlagener Fehler . Die Konsolenausgabe enthält: < /li>
< /ol>
Code: Select all
FAILURE: Build completed with 2 failures.
1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':shared_preferences_android:compileDebugUnitTestKotlin'.
> A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction
> Compilation error. See log for more details
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
==============================================================================
2: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':shared_preferences_android:compileProfileUnitTestKotlin'.
> A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction
> Compilation error. See log for more details
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
==============================================================================
Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
For more on this, please refer to https://docs.gradle.org/8.10.2/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.
BUILD FAILED in 1m 23s
< /code>
[list]
[*] Ausführen von Flutter -Lauf -v auch fehlschlägt (Ausgabe in der ursprünglichen Beschreibung). Die Konsolenausgabe enthält (aufgrund der übermäßigen Länge der Konsolenausgabe ist nur ein Teil im Haupttext enthalten; der vollständige Inhalt ist auf dem Foto ):
[/list]
[ ] FAILURE: Build failed with an exception.
[ ] * What went wrong:
[ ] Execution failed for task ':app:compileDebugJavaWithJavac'.
[ ] > Could not resolve all files for configuration ':app:androidJdkImage'.
[ ] > Failed to transform core-for-system-modules.jar to match attributes {artifactType=_internal_android_jdk_image,
org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}.
[ +4 ms] > Execution failed for JdkImageTransform: C:\Users\23259\AppData\Local\Android\sdk\platforms\android-34\core-for-system-modules.jar.[ +1 ms] > Error while executing process D:\Program Files\Android\Android Studio\jbr\bin\jlink.exe with arguments {--module-path
E:\WorkPlace\environment\gradle_cache_files\caches\8.10.2\transforms\8818889531d4cc222657e8daa8ba8c92-1a737d64-70f4-4939-938b-f7be28cb8845\transformed\output\temp\jmod --add-modules java.base --output
E:\WorkPlace\environment\gradle_cache_files\caches\8.10.2\transforms\8818889531d4cc222657e8daa8ba8c92-1a737d64-70f4-4939-938b-f7be28cb8845\transformed\output\jdkImage --disable-plugin system-modules}
< /code>
Relevante Konfigurationen: < /h1>
[list]
[*]android/build.gradle
[/list]
Code: Select all
allprojects {
repositories {
google()
mavenCentral()
}
}
rootProject.buildDir = "../build"
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(":app")
}
tasks.register("clean", Delete) {
delete rootProject.buildDir
}
< /code>
[list]
[*]android/app/build.gradle
[/list]
Code: Select all
plugins {
id "com.android.application"
id "kotlin-android"
// The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
id "dev.flutter.flutter-gradle-plugin"
}
def localProperties = new Properties()
def localPropertiesFile = rootProject.file("local.properties")
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader("UTF-8") { reader ->
localProperties.load(reader)
}
}
def flutterVersionCode = localProperties.getProperty("flutter.versionCode")
if (flutterVersionCode == null) {
flutterVersionCode = "1"
}
def flutterVersionName = localProperties.getProperty("flutter.versionName")
if (flutterVersionName == null) {
flutterVersionName = "1.0"
}
android {
namespace = "com.example.trip"
compileSdk = flutter.compileSdkVersion
ndkVersion = flutter.ndkVersion
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId = "com.example.trip"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
minSdk = flutter.minSdkVersion
targetSdk = flutter.targetSdkVersion
versionCode = flutterVersionCode.toInteger()
versionName = flutterVersionName
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig = signingConfigs.debug
}
}
}
flutter {
source = "../.."
}
< /code>
[list]
[*]gradle-wrapper.properties
[/list]
Code: Select all
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https://mirrors.aliyun.com/macports/distfiles/gradle/gradle-8.10.2-all.zip
< /code>
[list]
[*]pubspec.yml
[/list]
name: trip
description: "A new Flutter project."
publish_to: 'none'
version: 0.1.0
environment:
sdk: '>=3.4.0