【问题标题】:Android studio cannot resolve External libraties after updating to 3.1.3更新到 3.1.3 后,Android Studio 无法解析外部库
【发布时间】:2018-12-04 16:45:29
【问题描述】:

我将 android studio 更新到 3.1.3 。更新我实现的所有外部库后,显示“无法解析此方法”。但它工作正常,我可以运行该应用程序。它甚至以红色显示 setOnClickListener。

Build.gradle(App)

 apply plugin: 'com.android.application'

android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
defaultConfig {
    applicationId "satlaa.mysql_test"
    minSdkVersion 16
    targetSdkVersion 16
    versionCode 1
    versionName "1.0"
    testInstrumentationRunne
   "android.support.test.runner.AndroidJUnitRunner"
  }
 buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 
 'proguard-rules.pro'
    }
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
})
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:support-vector-drawable:27.1.1'
implementation 'com.android.support:recyclerview-v7:27.1.1'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation 'com.google.android.gms:play-services-ads:15.0.1'
implementation 'com.android.volley:volley:1.1.0'
implementation 'com.github.bumptech.glide:glide:3.7.0'
implementation 'com.bogdwellers:pinchtozoom:0.1'
implementation 'android.arch.paging:runtime:1.0.0'
implementation 'org.parceler:parceler-api:1.1.6'
implementation 'it.sephiroth.android.library.imagezoom:imagezoom:2.3.0'
}

Build.gradle(Project)

// Top-level build file where you can add configuration options common to all 
sub-projects/modules.

buildscript {
repositories {
    mavenCentral()
    google()
    jcenter()
}
dependencies {
    classpath 'com.android.tools.build:gradle:3.1.3'

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
   }
  }

 allprojects {
 repositories {
    jcenter()
    maven { url 'https://maven.google.com' }
 }
}

task clean(type: Delete) {
delete rootProject.buildDir
}

我试图删除 gradle 缓存。我什至确实使缓存无效并重新启动。

【问题讨论】:

  • 你可以清理项目或File -> Invalidate Caches
  • 我在我的问题中提到我做到了。
  • 在这个could-not-resolve-recyclerview-v7 滑行问题之后,recyclerview 解决了。但不是凌空抽射。
  • 重建你的项目。
  • @Dennis 问题在我删除 volley 实现后解决,然后运行应用程序并给出错误。然后再次重新实施凌空抽射,它奏效了。

标签: android android-studio


【解决方案1】:

有时会因为库缓存而发生这种情况,您可以尝试的是:

  1. 文件菜单中的缓存无效并重新启动

或者您可以手动执行此操作,非常有效:

  1. 转到\YourProject\.idea\libraries 并删除名称中包含support 的所有库,如果您已添加volley 库,则还要删除它

现在重新编译代码

【讨论】:

    猜你喜欢
    • 2018-11-20
    • 1970-01-01
    • 1970-01-01
    • 2018-11-01
    • 1970-01-01
    • 1970-01-01
    • 2016-07-21
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多