gpt4 book ai didi

android - 无法解析任何依赖项导入

转载 作者:行者123 更新时间:2023-11-29 01:02:16 25 4
gpt4 key购买 nike

#StrangeError 当我更改我的系统时,这个问题仍然存在。我在一台新笔记本电脑上打开了一个项目。现在我可以运行一个应用程序,Gradle 构建成功但所有依赖项导入显示未解决,如屏幕截图所示。

enter image description here

请注意,所有依赖项都已添加到应用程序级别 build.gradle 并且项目运行完美。

apply plugin: 'com.android.application'
android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
defaultConfig {
applicationId "in.kpis.servertracker"
minSdkVersion 16
targetSdkVersion 27
versionCode 1
versionName "1.0"
}
dataBinding {
enabled = true
}
buildTypes {
debug {
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}

useLibrary 'org.apache.http.legacy'
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
}
def SUPPORT_LIB_VER = '27.0.2'
def BUTTER_KNIFE_VER = '8.8.1'
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation project(':Baselib')
implementation "com.android.support:appcompat-v7:$SUPPORT_LIB_VER"
implementation "com.android.support:design:${SUPPORT_LIB_VER}"
implementation "com.android.support:cardview-v7:${SUPPORT_LIB_VER}"
implementation "com.android.support:recyclerview-v7:${SUPPORT_LIB_VER}"
implementation "com.jakewharton:butterknife:${BUTTER_KNIFE_VER}"
annotationProcessor "com.jakewharton:butterknife-compiler:${BUTTER_KNIFE_VER}"
}

Gradle 构建成功,没有显示任何错误。

我试过了

  • 清理、重建
  • 使用无效缓存重新启动 AS
  • 删除应用内的构建文件夹
  • 删除.gradle文件夹

最佳答案

在您的项目中有时会发生这种情况。

因此您需要删除项目目录中的.Gradle 文件夹

Projectdirectory->.gradle folder Delete it

然后打开Android Studio并构建项目

谢谢!

关于android - 无法解析任何依赖项导入,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50227984/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com