[英]Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'. problem on flutter
FAILURE: Build failed with an exception. FAILURE:构建失败并出现异常。
Failed to install the following Android SDK packages as some licences have not been accepted.
未能安装以下 Android SDK 软件包,因为某些许可证尚未被接受。 build-tools;28.0.3 Android SDK Build-Tools 28.0.3 platforms;android-28 Android SDK Platform 28 To build this project, accept the SDK license agreements and install the missing components using the Android Studio SDK Manager.
build-tools;28.0.3 Android SDK Build-Tools 28.0.3 platforms;android-28 Android SDK Platform 28 To build this project, accept the SDK license agreements and install the missing components using the Android Studio SDK Manager. Alternatively, to transfer the license agreements from one workstation to another, see http://d.android.com/r/studio-ui/export-licenses.html
或者,要将许可协议从一个工作站转移到另一个工作站,请参阅http://d.android.com/r/studio-ui/export-licenses.html
Using Android SDK: C:\Users\emre\AppData\Local\Android\sdk使用 Android SDK: C:\Users\emre\AppData\Local\Android\sdk
Try: Run with --stacktrace option to get the stack trace.尝试:使用 --stacktrace 选项运行以获取堆栈跟踪。 Run with --info or --debug option to get more log output.
使用 --info 或 --debug 选项运行以获得更多日志 output。 Run with --scan to get full insights.
运行 --scan 以获得完整的见解。
Get more help at https://help.gradle.org在https://help.gradle.org获得更多帮助
BUILD FAILED in 11s 11 秒内构建失败
FAILURE: Build failed with an exception. FAILURE:构建失败并出现异常。
C:\Users\emre.gradle\caches\5.6.2\file-changes\last-build.bin (Access is denied)
C:\Users\emre.gradle\caches\5.6.2\file-changes\last-build.bin(访问被拒绝)
Try: Run with --stacktrace option to get the stack trace.尝试:使用 --stacktrace 选项运行以获取堆栈跟踪。 Run with --info or --debug option to get more log output.
使用 --info 或 --debug 选项运行以获得更多日志 output。 Run with --scan to get full insights.
运行 --scan 以获得完整的见解。
Get more help at https://help.gradle.org在https://help.gradle.org获得更多帮助
BUILD FAILED in 11s Exception: Gradle task assembleDebug failed with exit code 1 11 秒内构建失败异常:Gradle 任务 assembleDebug 失败,退出代码为 1
Apparently you should accept the license,so in your command promp:显然你应该接受许可证,所以在你的命令提示符中:
cd /d "%ANDROID_SDK_ROOT%/tools/bin"
and then接着
sdkmanager --licenses
just accept the license and the error should goes away.只需接受许可证,错误就会消失。
Try running flutter doctor on cmd.尝试在 cmd 上运行 flutter 医生。 If it shows:
如果显示:
[√] Flutter (Channel stable, 1.22.5, on Microsoft Windows [Version 10.0.19042.685], locale en-US)
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
X Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses
[!] Android Studio (version 4.1.0)
X Flutter plugin not installed; this adds Flutter specific functionality.
X Dart plugin not installed; this adds Dart specific functionality.
[!] VS Code (version 1.52.0)
X Flutter extension not installed; install from
https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[√] Connected device (0 available)
Then run flutter doctor --android-licenses
, and accept all the license agreement.然后运行
flutter doctor --android-licenses
,并接受所有许可协议。 The problem must be solved then.那时问题必须解决。
Here is the main problem这是主要问题
Failed to install the following Android SDK packages as some licenses have not been accepted.未能安装以下 Android SDK 软件包,因为某些许可证尚未被接受。 build-tools;28.0.3 Android SDK Build-Tools 28.0.3 platforms;android-28 Android SDK Platform 28
build-tools;28.0.3 Android SDK Build-Tools 28.0.3 platforms;android-28 Android SDK Platform 28
As the error suggests, first accept all licenses by running the following command如错误所示,首先通过运行以下命令接受所有许可证
flutter doctor --android-licenses
next head over to https://androidsdkmanager.azurewebsites.net/Buildtools and download the build tool that corresponds to the one you are missing in this case 28.0.3 After downloading extract the zip file into C:\Android\Sdk\build-tools\28.0.3 if you are on windows and /Library/Android/sdk/build-tools/28.0.3 if you are on mac next head over to https://androidsdkmanager.azurewebsites.net/Buildtools and download the build tool that corresponds to the one you are missing in this case 28.0.3 After downloading extract the zip file into C:\Android\Sdk\build- tools\28.0.3如果你在 windows 和/Library/Android/sdk/build-tools/28.0.3如果你在 mac
finally, download the missing Android SDK platform 28 from https://androidsdkmanager.azurewebsites.net/SDKPlatform and unzip it into /Library/Android/sdk/platforms/android-28 if you are on mac or C:\Android\Sdk\platforms\android-28 if you are on windows finally, download the missing Android SDK platform 28 from https://androidsdkmanager.azurewebsites.net/SDKPlatform and unzip it into /Library/Android/sdk/platforms/android-28 if you are on mac or C:\Android\Sdk\平台\android-28如果你在 windows
Run your project (flutter run) and enjoy运行你的项目(flutter run)并享受
In my own case, Deleting.gradle folder solved the problem.在我自己的情况下,Deleting.gradle 文件夹解决了这个问题。 Just head-on into your usual project dir and navigate into android and you'd find.gradle folder waving a hand in there.
直接进入你常用的项目目录并导航到 android ,你会发现.gradle 文件夹在那里挥手。 I hope this helps somebody out there.
我希望这可以帮助那里的人。 But make sure you have done
但请确保您已完成
flutter doctor --andriod-licences
Don't do anything, like changing the SDK path or updating tools.不要做任何事情,例如更改 SDK 路径或更新工具。
At first, what you should try to do is this:首先,您应该尝试这样做:
Remove your physical device from your machine which is connected via USB and instead of the physical device, run your application on a browser (I suggest Chrome) and if there is no other issue then you will find the error will have been tackled.从通过 USB 连接的机器中删除您的物理设备,而不是物理设备,在浏览器(我建议 Chrome)上运行您的应用程序,如果没有其他问题,那么您会发现错误已得到解决。 So I am saying that the problem is neither in the path nor in the software or code.
所以我说问题既不在路径上,也不在软件或代码上。 Please try this suggestion first, because I wasted a full day trying to tackle this problem!
请先尝试这个建议,因为我浪费了一整天的时间来解决这个问题!
go setting android SDK SDK Tools go 设置 android SDK SDK 工具
and then click show package details然后单击显示 package 详细信息
and Android SDK Build-Tools Download 28.0.3和 Android SDK 构建工具下载 28.0.3
Apply and ok:)申请并确定:)
We just need to install proper Android version manually我们只需要手动安装正确的 Android 版本
It worked for me.它对我有用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.