我正在尝试使用新Flutter项目的tensorflow lite包连接我的三星手机。我只在android/app/build.gradle文件中修改了
compileSdkVersion 31
minSdkVersion 21
targetSdkVersion 31
pubspec.yaml
dependencies:
flutter:
sdk: flutter
camera: ^0.9.4+5
image: ^3.1.0
tflite_flutter: ^0.9.0
tflite_flutter_helper: ^0.3.1
path_provider: ^2.0.8
但是,我得到以下错误。任何人都可以帮助我解决thos错误?我应该怎么做?
Launching lib/main.dart on SM N981N in debug mode...
Running Gradle task 'assembleDebug'...
e: /Users/sangyoonhan/flutter/.pub-cache/hosted/pub.dartlang.org/tflite_flutter_helper-0.3.1/android/src/main/kotlin/com/tfliteflutter/tflite_flutter_helper/TfliteFlutterHelperPlugin.kt: (43, 1): Class 'TfliteFlutterHelperPlugin' is not abstract and does not implement abstract member public abstract fun onRequestPermissionsResult(p0: Int, p1: Array<(out) String!>, p2: IntArray): Boolean defined in io.flutter.plugin.common.PluginRegistry.RequestPermissionsResultListener
e: /Users/sangyoonhan/flutter/.pub-cache/hosted/pub.dartlang.org/tflite_flutter_helper-0.3.1/android/src/main/kotlin/com/tfliteflutter/tflite_flutter_helper/TfliteFlutterHelperPlugin.kt: (143, 2): 'onRequestPermissionsResult' overrides nothing
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':tflite_flutter_helper:compileDebugKotlin'.
> 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
BUILD FAILED in 2s
我将离开Flutter医生的信息。我不知道为什么这些错误正在发生
(base) sangyoonhan@Sangyoonui-MacBookPro untitled % flutter doctor -v
[✓] Flutter (Channel stable, 3.3.8, on macOS 13.0.1 22A400 darwin-x64, locale ko-KR)
• Flutter version 3.3.8 on channel stable at /Users/sangyoonhan/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 52b3dc25f6 (8주 전), 2022-11-09 12:09:26 +0800
• Engine revision 857bd6b74c
• Dart version 2.18.4
• DevTools version 2.15.0
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
• Android SDK at /Users/sangyoonhan/Library/Android/sdk
• Platform android-33, build-tools 31.0.0
• Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 14.2)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 14C18
• CocoaPods version 1.11.3
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2021.2)
• 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 11.0.12+0-b1504.28-7817840)
[✓] VS Code (version 1.74.1)
• VS Code at /Users/sangyoonhan/Downloads/학교/Visual Studio Code.app/Contents
• Flutter extension can be installed from:
🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[✓] Connected device (4 available)
• SM N981N (mobile) • R3CR10GC91P • android-arm64 • Android 12 (API 31)
• iPhone 14 Pro Max (mobile) • 6D97D66D-63AB-4822-9EF5-D0C7DA86B6D4 • ios •
com.apple.CoreSimulator.SimRuntime.iOS-16-2 (simulator)
• macOS (desktop) • macos • darwin-x64 • macOS 13.0.1 22A400
darwin-x64
• Chrome (web) • chrome • web-javascript • Google Chrome 108.0.5359.124
[✓] HTTP Host Availability
• All required HTTP hosts are available
• No issues found!
快来人啊!
1条答案
按热度按时间huus2vyu1#
我在连接相机包时遇到了此问题。此链接是问题的解决方案,可以删除与“:tflite_flutter_helper:compileDebugKotlin”相关的错误。
https://github.com/am15h/tflite_flutter_helper/issues/57#issuecomment-1128960033
修复此错误后,由于使用相机包的冲突,错误将出现,因为tflite_flutter_helper:^0.3.1软件包使用的相机版本比项目中使用的版本旧。
要解决您的问题,请尝试:
1.替换:
tflite_flutter_helper:^0.3.1
到
1.将相机包从依赖项移动到dependency_overrides
1.flutter pub get 或 flutter clean 和 flutter pub get
下面是如何在pubspec.yaml中获取它的示例: