gpt4 book ai didi

android - Flutter:Gradle 构建无法生成 .apk 文件。该文件可能是在 \build 下生成的,但该工具找不到它

转载 作者:行者123 更新时间:2023-12-03 02:38:46 31 4
gpt4 key购买 nike

我正在尝试测试应用程序。由于应用程序无法调试/运行,我一直遇到一个奇怪的问题。 SDK 版本为 28,其余版本如下:

Flutter 1.13.9-pre.79 • channel master • https://github.com/flutter/flutter.git
Framework • revision 9eb9ea0ffa (6 hours ago) • 2020-01-13 21:30:42 -0800
Engine • revision 0235a50843
Tools • Dart 2.8.0 (build 2.8.0-dev.0.0 28c335d5a2)

enter image description here

Gradle build failed to produce an .apk file. It's likely that this file was generated under C:\Development\\build, but the tool couldn't find it.



有没有办法通过提供或提供输出路径给 Gradle 来传递此问题或允许我运行的配置? .apk 似乎是作为错误状态生成的。

enter image description here

更新:
Android Studio -v 3.5.3 
Gradle -v 3.4.2
Gradle Wrapper -v 5.1.1

最佳答案

就我而言,我有一个这样的多口味应用程序:
2021 年 4 月 15 日更新:

{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "YOUR_PROJECT_NAME",
"program": "lib/main.dart",
"request": "launch",
"type": "dart",
"args": [
"--flavor",
"ADD_YOUR_FLAVOR_NAME_HERE" //development or staging or production
]
}
]
另一种方式:
 android {

...

buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
}
}

flavorDimensions "flavor-type"

productFlavors{
development{
dimension "flavor-type"
}
staging{
dimension "flavor-type"
}
production{
dimension "flavor-type"
}
}
}
因此,如果您想运行应用程序,则必须编写 flavor 名称,然后编写包含 main() 函数的类名称
flutter run --flavor staging -t lib/main_staging.dart
我解决了我的错误并构建了.apk

关于android - Flutter:Gradle 构建无法生成 .apk 文件。该文件可能是在 <app_root>\build 下生成的,但该工具找不到它,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59732883/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com