Это все, что я уже пробовал:
- Реконструкция проекта: вся моя папка Android была повреждена. Я удалил его и воссоздал с нуля, используя flutter create. Теперь мой проект использует современное внедрение v2 и имеет чистые стандартные файлы Gradle (settings.gradle.kts, build.gradle.kts).
- Проверка среды: flutter Doctor -v не показывает НИКАКИХ ПРОБЛЕМ. Мой Flutter SDK чист, моя набор инструментов Android идеален, лицензии принимаются.
- Очистка кэша Gradle: я полностью удалил всю папку C:\Users\YourUser\.gradle и позволил Gradle повторно загрузить все с нуля. Сборка по-прежнему не удалась.
- Обновление зависимостей: я запустил обновление flutter pub, чтобы получить последние версии всех моих пакетов. Я также пробовал обновить их вручную в pubspec.yaml. Ошибка сохраняется.
- Восстановление кэша публикации: я запустил восстановление кэша публикации dart, чтобы исправить любые повреждения в центральном кэше пакетов. Ошибка сохраняется.
- Анализ кода/плагина: ошибка всегда указывает на плагин (например, voice_to_text, Permission_handler и т. д.) и ссылку на регистратор, который взят из старой версии v1.
Вот мой последний журнал ошибок сборки:
Launching lib\main.dart on sdk gphone64 x86 64 in debug mode...
Running Gradle task 'assembleDebug'...
warning: [options] source value 8 is obsolete and will be removed in a future release
warning: [options] target value 8 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
3 warnings
e: file:///C:/Users/Mack/AppData/Local/Pub/Cache/hosted/pub.dev/speech_to_text-6.6.2/android/src/main/kotlin/com/csdcorp/speech_to_text/SpeechToTextPlugin.kt:37:48 Unresolved reference 'Registrar'.
e: file:///C:/Users/Mack/AppData/Local/Pub/Cache/hosted/pub.dev/speech_to_text-6.6.2/android/src/main/kotlin/com/csdcorp/speech_to_text/SpeechToTextPlugin.kt:139:37 Unresolved reference 'Registrar'.
e: file:///C:/Users/Mack/AppData/Local/Pub/Cache/hosted/pub.dev/speech_to_text-6.6.2/android/src/main/kotlin/com/csdcorp/speech_to_text/SpeechToTextPlugin.kt:141:54 Unresolved reference 'activity'.
e: file:///C:/Users/Mack/AppData/Local/Pub/Cache/hosted/pub.dev/speech_to_text-6.6.2/android/src/main/kotlin/com/csdcorp/speech_to_text/SpeechToTextPlugin.kt:142:23 Unresolved reference 'addRequestPermissionsResultListener'.
e: file:///C:/Users/Mack/AppData/Local/Pub/Cache/hosted/pub.dev/speech_to_text-6.6.2/android/src/main/kotlin/com/csdcorp/speech_to_text/SpeechToTextPlugin.kt:143:55 Unresolved reference 'context'.
e: file:///C:/Users/Mack/AppData/Local/Pub/Cache/hosted/pub.dev/speech_to_text-6.6.2/android/src/main/kotlin/com/csdcorp/speech_to_text/SpeechToTextPlugin.kt:143:76 Unresolved reference 'messenger'.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':speech_to_text:compileDebugKotlin'.
> 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.
BUILD FAILED in 5m 30s
Error: Gradle task assembleDebug failed with exit code 1
Подробнее здесь: https://stackoverflow.com/questions/798 ... e-registra
Мобильная версия