Could not find appcompat-1.2.0.aar (androidx.appcompat:appco



我已经将local_auth: 1.1.8添加到我的flutter项目的pubspec.yaml文件中,并执行了flutter pub get命令,没有任何问题,但是当我运行项目时,它无法下载一些aar文件。这是当我在pub.dev中添加任何其他库到项目时它工作得很好。
我尝试在启用代理和VPN的情况下运行项目,但没有任何改变。下面是错误:

FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:checkDebugAarMetadata'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
> Could not find appcompat-1.2.0.aar (androidx.appcompat:appcompat:1.2.0).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/androidx/appcompat/appcompat/1.2.0/appcompat-1.2.0.aar
> Could not find appcompat-resources-1.2.0.aar (androidx.appcompat:appcompat-resources:1.2.0).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/androidx/appcompat/appcompat-resources/1.2.0/appcompat-resources-1.2.0.aar
* 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 13s
Exception: Gradle task assembleDebug failed with exit code 1

如何解决这个问题?如果我有文件,我可以手动将文件放在它使用的路径中吗?

我知道有点晚了,但也许将来它会对别人有用。

您所面临的错误是由于制裁,您可以通过以下步骤修复它:

  • 启用VPN
  • 使android studio的缓存失效并重新启动它
  • 删除全局.gradle文件夹(如果没有手动更改,linux系统默认位于~.gradle)
  • 使用android-studio同步项目

如果你总是使用android-studio,而你已经启用了VPN,你不会再面临这样的问题。作为一种替代方法,您可以为android-studio设置代理(通过settings>http proxy)和gradle(通过它的全局设置)