我正在创建一个 Flutter 应用程序,我正在尝试为 Android 测试它。当我打开模拟器时,它运行正常,但是当我尝试运行我的应用程序时,出现此错误...谁能帮忙解决?它在我 iPhone 上的 Xcode 中完美运行,但似乎无法在 Android 上运行...
Launching lib/main.dart on sdk gphone x86 arm in debug mode...
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... FAILURE: Build failed with an exception.
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... * What went wrong:
Running Gradle task 'assembleDebug'... Execution failed for task ':app:processDebugResources'.
Running Gradle task 'assembleDebug'... > A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
Running Gradle task 'assembleDebug'... > Android resource linking failed
Running Gradle task 'assembleDebug'... /Users/ragz/.gradle/caches/transforms-2/files-2.1/554200784d0157df45da8212b6e09519/play-services-ads-lite-19.7.0/AndroidManifest.xml:27:5-43:15: AAPT: error: unexpected element found in .
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... * Try:
Running Gradle task 'assembleDebug'... 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.
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... * Get more help at https://help.gradle.org
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... BUILD FAILED in 4m 29s
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... Done 305.2s
The build failed likely due to AndroidX incompatibilities in a plugin.
The tool is about to try using Jetifier to solve the incompatibility.
Building plugin flutter_tts...
Running Gradle task 'assembleAarRelease'...
Running Gradle task 'assembleAarRelease'... Done 87.4s
*********************************************************
WARNING: This version of flutter_tts will break your Android build if it or its dependencies aren't compatible with AndroidX.
See for more information on the problem and how to fix it.
This warning prints for all Android build failures. The real root cause of the error may be unrelated.
*********************************************************
FAILURE: Build failed with an exception.
What went wrong:
A problem occurred configuring root project 'flutter_tts'.
SDK location not found. Define location with an ANDROID_SDK_ROOT environment variable or by setting the sdk.dir path in your project's local properties file at '/Users/ragz/.pub-cache/hosted/pub.dartlang.org/flutter_tts-3.0.0/android/local.properties'.
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
BUILD FAILED in 1m 24s
Exception: The plugin flutter_tts could not be built due to the issue
above.
答案 0 :(得分:0)
检查您的 minSDKVersion 21
是否在 build.gradle 中。
答案 1 :(得分:0)
这是我的颤振医生运行(对我来说似乎没有问题,也许有?我不确定)-
[✓] Flutter (Channel stable, 2.0.2, on macOS 11.2 20D64 darwin-x64, locale en-GB)
• Flutter version 2.0.2 at /Users/ragz/flutter
• Framework revision 8962f6dc68 (2 weeks ago), 2021-03-11 13:22:20 -0800
• Engine revision 5d8bf811b3
• Dart version 2.12.1
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at /Users/ragz/Library/Android/sdk
• Platform android-30, build-tools 30.0.3
• Java binary at: /Applications/Android
Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build
1.8.0_242-release-1644-b3-6915495)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 12.4, Build version 12D4e
• CocoaPods version 1.10.1
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 4.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
1.8.0_242-release-1644-b3-6915495)
[✓] VS Code (version 1.54.3)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.20.0
[✓] Connected device (2 available)
• sdk gphone x86 arm (mobile) • emulator-5554 • android-x86 • Android 11 (API
30) (emulator)
• Chrome (web) • chrome • web-javascript • Google Chrome