我正在使用不同的方式构建应用程序,两种工作但一种失败。
方法:1(工作)
flutter build appbundle
方法:2(工作)
在 Android Studio 中打开模块,然后选择
Build > Generate Signed Bundle/APK... > filling all info afterwards
在这种情况下,我可以同时构建 app bundle 和 APK 文件。
方法:3(不工作)
flutter build apk
我收到此错误:
FAILURE: Build failed with an exception. * What went wrong: A problem occurred configuring root project 'android_intent'.
SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.
如果我删除
android_intent
,我开始在其他包中出现错误,所以包肯定不是问题。我仔细检查了我有local.properties
, gradle.properties
和 settings.gradle
在我的android
根文件夹。我的其他项目似乎有效。
最佳答案
我遇到了 的这个问题文件选择器 插件,只需将 android/build.gradle 中的 gradle 版本升级到以下版本之一:
3.3.3
3.4.3
3.5.4
3.6.4
4.0.1
我点击了这个链接:file_picker troubleshooting
关于android - Flutter:未找到 SDK 位置。使用 local.properties 文件中的 sdk.dir 或使用 ANDROID_HOME 环境变量定义位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61086708/