我正在 Android Studio 中构建一个支持 AndroidX 和 Kotlin 的 Flutter 应用程序。我从 pub.dev 添加了 Google Nearby Messages API并尝试构建。
这会导致以下错误:
Launching lib\main.dart on SM T395 in debug mode...
Initializing gradle...
Resolving dependencies...
Running Gradle task 'assembleDebug'...
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':google_nearby_messages_api:processDebugManifest'.
> Cannot read packageName from C:\src\flutter\.pub-cache\hosted\pub.dartlang.org\google_nearby_messages_api-0.0.15\android\src\main\AndroidManifest.xml
* 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 15s
Finished with error: Gradle task assembleDebug failed with exit code 1
如果我打开 Android 模块并运行 Gradle 同步,则会出现此错误:
ERROR: Cannot read packageName from C:\src\flutter\.pub-cache\hosted\pub.dartlang.org\google_nearby_messages_api-0.0.15\android\src\main\AndroidManifest.xml
Affected Modules: google_nearby_messages_api
没有相关的 Dart 代码可显示。