首页 > 解决方案 > 未解决的参考:android

问题描述

在此处输入图像描述

从图中可以看出,Android Studio 无法在这一行中解析此导入“com.android”。

import com.android.volley.toolbox.Volley

我尝试了从其他一些答案中找到的以下故障排除:

  1. 清理和重建
  2. 文件 -> 使缓存无效并重新启动
  3. 通过 build.gradle 打开项目
  4. 删除项目中的.idea文件夹
  5. 安装旧 sdk (Android 6.0) 和最新版本

但似乎没有任何帮助。请帮忙。

build.gradle(模块)文件: https ://textsaver.flap.tv/lists/326r

apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'

android {
    compileSdkVersion 29
    buildToolsVersion "29.0.2"
    defaultConfig {
        applicationId "..."
        minSdkVersion 15
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'

        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'androidx.appcompat:appcompat:1.0.2'
    implementation 'androidx.core:core-ktx:1.0.2'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'com.google.android.material:material:1.0.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test.ext:junit:1.1.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'

}

标签: androidandroid-studiokotlin

解决方案


尝试删除构建文件夹然后重新同步。有时即使使用./gradlew clean命令,生成的文件也没有正确删除


推荐阅读