在 vscode 中运行颤振应用程序并收到此错误 无法确定任务':app:compileDebugJavaWithJavac'的依赖关系



我目前在物理设备(手机(中运行flutter应用程序时遇到问题。我使用的是安卓studio4和vscode。错误消息如下。

Launching libmain.dart on TECNO B1f in debug mode...
libmain.dart:1
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> Failed to find target with hash string 'android-29' in: C:UsersKitssonAppDataLocalAndroidsdk
* 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 7m 8s
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)

我建议4种方法来解决这个问题,一个接一个地尝试,直到它对你有效:

  1. 打开终端-运行flutter doctor --android-licenses。只要接受所有,它就应该起作用,如果没有,那么跳到下一步。

  2. android => app => build.gradle中添加buildToolsVersion

android { compileSdkVersion 29 buildToolsVersion "29.0.0" ... ... }

  1. 当你的依赖关系中有一些东西需要像firebase这样的互联网时,就会经常发生这种情况。只需打开互联网或wifi

  2. 如果它们都不起作用,那么关闭开发者选项,然后按构建号7次再次打开它,这将撤销所有usb调试身份验证,并询问是否信任您的开发机器,按是,您就可以使用了

相关内容

最新更新