每当我尝试在Android模拟器上运行Flutter项目时,我都会收到以下错误:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:dexBuilderDebug'.
> There were multiple failures while executing work items
> A failure occurred while executing com.android.build.gradle.internal.dexing.DexWorkAction
> Failed to process: project_path/android/app/build/intermediates/transforms/APMSPlugin/debug/246, project_path/android/app/build/intermediates/transforms/APMSPlugin/debug/247
字符串
还有更多这样的
日志还包含许多:
Caused by: java.util.concurrent.ExecutionException: com.android.tools.r8.kotlin.H
型
和
Caused by: [CIRCULAR REFERENCE: com.android.tools.r8.kotlin.H]
型
flutter doctor --verbose result:
[✓] Flutter (Channel stable, 3.16.4, on macOS 14.1.1 23B81 darwin-arm64, locale en-AE)
• Flutter version 3.16.4 on channel stable at /Users/hassanmohamed/Development/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 2e9cb0aa71 (2 weeks ago), 2023-12-11 14:35:13 -0700
• Engine revision 54a7145303
• Dart version 3.2.3
• DevTools version 2.28.4
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
• Android SDK at /Users/hassanmohamed/Library/Android/sdk
• Platform android-34, build-tools 34.0.0
• ANDROID_HOME = /Users/hassanmohamed/Library/Android/sdk
• ANDROID_SDK_ROOT = /Users/hassanmohamed/Library/Android
• Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 17.0.7+0-17.0.7b1000.6-10550314)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 15.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 15C65
• CocoaPods version 1.13.0
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2023.1)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 17.0.7+0-17.0.7b1000.6-10550314)
[✓] IntelliJ IDEA Community Edition (version 2022.2.5)
• IntelliJ at /Applications/IntelliJ IDEA CE.app
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin version 222.4582
[✓] Connected device (4 available)
• sdk gphone64 arm64 (mobile) • emulator-5554 • android-arm64 • Android 12 (API 32) (emulator)
• iPhone 15 Pro Max (mobile) • 7F0F134E-A16B-47E6-843D-C265C809FBC4 • ios • com.apple.CoreSimulator.SimRuntime.iOS-17-2 (simulator)
• macOS (desktop) • macos • darwin-arm64 • macOS 14.1.1 23B81 darwin-arm64
• Chrome (web) • chrome • web-javascript • Google Chrome 120.0.6099.129
! Error: Browsing on the local area network for iPhone. Ensure the device is unlocked and attached with a cable or associated with the same local area network as this Mac.
The device must be opted into Developer Mode to connect wirelessly. (code -27)
[✓] Network resources
• All expected network resources are available.
• No issues found!
型
我尝试将gradle版本更新到8.2和8.5,但由于flutter包而无法更新。
2条答案
按热度按时间g52tjvyc1#
感谢ChatGPT,我找到了解决方案,只需将
minifyEnabled true
添加到buildTypes就解决了这个问题,下面是代码:字符串
qgzx9mmu2#
在项目目录中运行以下命令以清理和重建项目:
字符串
更新Gradle版本:确保您使用的是兼容版本的Gradle。打开android/build.gradle文件并更新Gradle版本。例如:
类路径'com.android.tools.build:gradle:4.1.0'
更新Android Gradle插件:
implementation 'com.android.tools.build:gradle:4.1.0' Increase Heap Size:
型
https://www.fiverr.com/jinnat75/do-professional-flutter-mobile-app-development-services