Flutter说它“无法解决项目" [英] Flutter says it 'Could not resolve project'
问题描述
我正在尝试为Flutter运行此HERE映射示例:
I'm trying to run this HERE maps example for Flutter:
https://github.com/etzuk/flutter_here_maps
.我已按照README说明进行操作:
. I've followed the README instructions:
Android gradle.
Android gradle.
Import HERE-sdk.aar as aar module. (AndroidStudio) File -> New -> New Module -> Import .jar/.aar module.
Add your keys to manifest and service as described at HereMaps guide
Change the intent-filter in HereMaps Service to app package name.
我正在尝试运行该示例,但仍然可以给我以下信息:
I'm trying to run the example and it still gives me this:
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:preDebugBuild'.
> Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'.
> Could not resolve project :HERE-sdk.
Required by:
project :app > project :flutter_here_maps
> Unable to find a matching configuration of project :HERE-sdk: None of the consumable configurations have attributes.
* 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.
我将HERE-sdk.aar
文件添加到Android应用程序目录中的libs文件夹中.使用File -> New -> New Module -> Import .jar/.aar module
选项导入的文件,在Project Structure
中添加了模块,但看不到它.如果我再试一次,它会显示项目已经包含名称为HERE-sdk的子项目",但是在列表中不可见.
I added HERE-sdk.aar
file to a libs folder in the Android app directory. the imported the file with the File -> New -> New Module -> Import .jar/.aar module
option and in Project Structure
I added the module but I can't see it. If I try again, it says `Project already contains subproject with name HERE-sdk', but it's not visible in the list.
我还在应用程序级别的build.gradle文件中添加了以下内容,就像在一个有效的Android项目中所做的一样:
I also added the following to the app level build.gradle file, as I did in an Android project that worked:
repositories {
flatDir {
dirs 'libs'
}
mavenCentral()
}
dependencies {
implementation(name: 'HERE-sdk', ext: 'aar')
...
}
推荐答案
似乎缺少某些导入.您应该尝试flutter pub get
更新软件包,或flutter pub cache repair
,这将重新导入所有依赖项.至少对我来说,缓存修复解决了大多数问题.
Seems like some imports are missing. You should try flutter pub get
to update packages, or flutter pub cache repair
, which will re-import all dependencies. At least for me the cache repair fixed most of the issues.
这篇关于Flutter说它“无法解决项目"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!