当我尝试运行flutter项目时缺少android.jar

x6492ojm  于 2023-04-22  发布在  Flutter
关注(0)|答案(4)|浏览(261)

嘿,我尝试运行一个项目,但它一直显示android.jar丢失。我该怎么办?

Launching lib\main.dart on SM G970F in debug mode...

FAILURE: Build failed with an exception.

* What went wrong:
A problem was found with the configuration of task ':app:processDebugResources'.
> File 'C:\Users\adamr\AppData\Local\Android\sdk\platforms\android-28\android.jar' specified for property 'androidJar' does not exist.

* 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 12s
kqlmhetl

kqlmhetl1#

当您的平台SDK缺少android.jar文件时会出现此问题。
下载android.jar文件并粘贴到您的 * platform SDK* 的目录中

https://github.com/Sable/android-platforms

它解决了我在Linux中的问题。我相信它也能在Windows上工作️。

4dc9hkyq

4dc9hkyq2#

这似乎是你的Android SDK的问题.尝试去Android Studio,检查你是否已经安装了所有需要的SDK,必须运行flutter doctor -v次会告诉你.
如果flutter doctor没问题,那么我建议你卸载当前的android SDK并重新安装。

ljsrvy3e

ljsrvy3e3#

您的android sdk不完整。请尝试从Android Studio SDK管理器安装它。文件夹应如下所示:/Users/shooding/Library/Android/sdk/platforms/android-28/

├── android-stubs-src.jar
├── android.jar
├── build.prop
├── data
├── framework.aidl
├── optional
├── package.xml
├── sdk.properties
├── skins
├── source.properties
├── templates
└── uiautomator.jar
bxgwgixi

bxgwgixi4#

fluttercampus.com上提供了此错误的详细解决方案。

相关问题