gpt4 book ai didi

Android Studio 运行应用程序时出现编译时错误

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

今天我在使用 Android Studio IDE 时遇到了一个奇怪的问题。

您可以看到我没有添加 RecyclerViewSupport-v4 的依赖项,并且类显示错误。现在好了。但问题是我能够运行项目,我的应用程序在移动设备上运行,gradle 不显示有关有错误的类的错误。

我不希望 Android Studio 有这种行为。

image

你可以看到我没有添加 RecyclerView 依赖。

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.google.code.gson:gson:2.7"
implementation "com.android.support:cardview-v7:$SUPPORT_LIB_VER"
implementation "com.squareup.retrofit2:retrofit:${RETROFIT_VER}"
implementation "com.squareup.retrofit2:converter-gson:${RETROFIT_VER}"
implementation "com.jakewharton:butterknife:$BUTTER_KNIFE_VER"
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation 'com.android.support:support-v4:26.1.0'
annotationProcessor "com.jakewharton:butterknife-compiler:$BUTTER_KNIFE_VER"
implementation "com.intuit.sdp:sdp-android:$SDP_VERSION"
implementation "com.intuit.ssp:ssp-android:$SDP_VERSION"
implementation 'com.squareup.okhttp3:logging-interceptor:3.10.0'
implementation 'com.tencent.mm.opensdk:wechat-sdk-android-without-mta:+'
}

现在看看 Android Studio 的魔力

enter image description here

这是 Android Studio 的一个新功能,它的 gradle 构建成功但编译时错误?不不不!!!

我已经试过了:

  • 清理重建项目
  • 重启IDE
  • 删除构建文件夹
  • 删除.gradle文件夹
  • 使缓存失效并重启

最佳答案

以下对我有用:

  1. 删除.idea文件夹
  2. 清理 + 重建

关于Android Studio 运行应用程序时出现编译时错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50549366/

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