颤振:未找到 SDK 位置.使用 local.properties 文件中的 sdk.dir 或 ANDROID_HOME 环境变量定义位置 [英] Flutter: SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable
问题描述
我正在使用不同的方式构建应用程序,两种方式有效但一种方式失败.
I'm building app using different ways, two works but one fails.
方法:1(工作)
flutter build appbundle
<小时>
方法:2(工作)
在Android Studio中打开模块,然后选择
Opening module in Android Studio, after that, choosing
Build > Generate Signed Bundle/APK... > filling all info afterwards
在这种情况下,我可以构建应用程序包和 APK 文件.
In this case, I am able to build both app bundle and APK file.
方法:3(不起作用)
flutter build apk
我收到此错误:
FAILURE:构建失败,出现异常.* 什么地方出了错:配置根项目android_intent"时出现问题.
FAILURE: Build failed with an exception. * What went wrong: A problem occurred configuring root project 'android_intent'.
未找到 SDK 位置.使用 local.properties 文件中的 sdk.dir 或 ANDROID_HOME 环境变量定义位置.
SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.
<小时>
如果我删除 android_intent
,我会开始在其他包中出错,所以这个包肯定不是问题.我仔细检查了我有
If I remove android_intent
, I start getting error in other packages, so definitely the package isn't a problem. I double checked that I have
local.properties
、gradle.properties
和 settings.gradle
在我的 android
根文件夹中.
local.properties
, gradle.properties
and settings.gradle
in my android
root folder.
我的其他项目似乎也有效.
And my other projects seem to work.
推荐答案
我在使用 file_picker 插件时遇到了这个问题,只需将 android/build.gradle 中的 gradle 版本升级到以下版本之一:
I have faced this issue with file_picker plugin, Just upgrade gradle version in android/build.gradle to one of these versions :
3.3.3
3.4.3
3.5.4
3.6.4
4.0.1
我点击了这个链接:file_picker 故障排除
这篇关于颤振:未找到 SDK 位置.使用 local.properties 文件中的 sdk.dir 或 ANDROID_HOME 环境变量定义位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!