【问题标题】:import android.view.View; cannot resolve symbol 'view'导入android.view.View;无法解析符号“视图”
【发布时间】:2019-10-30 23:54:53
【问题描述】:

在 android studio 3.4.1 onClick 监听器中,没有找到,现在它显示 setOnEditorActionListener

bth.setOnEditorActionListener(new TextView.OnEditorActionListener() {
                @Override
                public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
                    return false;
                }
            });

导入android.view.View;
无法解析符号“视图”

这是一个工作项目,它显示此错误
如果我运行,它将毫无问题地运行
我从另一个PC打开它,没有这样的问题。


我正在使用最新的 android studio 3.4.1

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    //noinspection GradleCompatible
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support:animated-vector-drawable:28.0.0'
    implementation 'com.android.support:support-v4:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.android.support:design:28.0.0'
    //firebase
    implementation 'com.google.firebase:firebase-core:16.0.4'
    implementation 'com.crashlytics.sdk.android:crashlytics:2.9.6'
    //slider
    implementation project(':library')
    //glide
    implementation 'com.github.bumptech.glide:glide:4.7.1'
    //recyclerview gravity
    implementation 'com.github.rubensousa:gravitysnaphelper:1.5'
    // rating library
    implementation 'com.github.ome450901:SimpleRatingBar:1.4.2'
    //cardview
    implementation 'com.android.support:cardview-v7:28.0.0'

    //retrofit
    implementation 'com.squareup.retrofit2:retrofit:2.3.0'
    implementation 'com.google.code.gson:gson:2.8.2'
    implementation 'com.squareup.retrofit2:converter-gson:2.3.0'

    implementation 'com.squareup.okhttp3:logging-interceptor:3.8.0'

    //timber-logging interceptor
    implementation 'com.jakewharton.timber:timber:4.7.1'

    //round corner image
    implementation 'com.makeramen:roundedimageview:2.3.0'

    //Html tag remover
    implementation 'org.jsoup:jsoup:1.11.3'

    implementation 'com.google.code.gson:gson:2.6.2'

    //    dots indicator
    implementation 'com.ryanjeffreybrooks:indefinitepagerindicator:1.0.10'
    implementation 'com.tbuonomo.andrui:viewpagerdotsindicator:2.1.2'

    implementation 'com.google.firebase:firebase-messaging:17.6.0'
    annotationProcessor 'com.github.bumptech.glide:compiler:4.7.1'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'

    // for unit test
    testImplementation 'com.squareup.okhttp3:mockwebserver:3.12.0'
    testImplementation 'org.mockito:mockito-android:2.7.22'

    implementation 'com.github.sharish:ShimmerRecyclerView:v1.3'


}

我尝试了无效的现金并重新启动
重新启动电脑
重新安装 android studio
但是没有结果
我的团队成员 android studio confi
Android Studio 3.2.1
构建 #AI-181.5540.7.32.5056338,构建于 2018 年 10 月 9 日
JRE:1.8.0_152-release-1136-b06 amd64
JVM:JetBrains s.r.o 的 OpenJDK 64 位服务器 VM
Windows 10 10.0

我的安卓工作室

Android Studio 3.4.1
构建 #AI-183.6156.11.34.5522156,构建于 2019 年 5 月 2 日
JRE:1.8.0_152-release-1343-b01 amd64
JVM:JetBrains s.r.o 的 OpenJDK 64 位服务器 VM
Windows 10 10.0


项目来自git

【问题讨论】:

  • 你确定没有其他 Gradle 错误吗?这种导入失败通常与无法同步/构建的项目相关联。如果您无法导入视图,我敢打赌项目/gradle 结构中存在更深层次的问题。我知道你是说如果你运行它,它可以工作,如果你进入命令行并输入 ./gradlew clean assembleDebug ,它是否工作? (在项目的文件夹中)
  • 但相同的代码在我的团队成员电脑上工作
  • 他们使用的是android studio的旧v,我使用的是最新的
  • 这只是参考
  • 老实说,您将不得不提供更多信息。你基本上没有提供关于你的机器有什么不同的信息(除了 AS 版本)。您的同事使用的是什么版本的 Android Studio?

标签: android android-studio android-layout android-intent


【解决方案1】:

抱歉来晚了,我遇到了同样的问题,经过几个小时的搜索,我发现 View 类已损坏,您可以通过删除 SDK(android 28)中的平台并安装新平台来解决问题,希望对Goodluck有所帮助

【讨论】:

  • +1,当我在 Windows 上时,chkdsk 在我的设备上损坏了几次 sdk 文件。但也可能是 Gradle 缓存问题
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2014-02-13
  • 2021-01-13
  • 2020-01-22
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-01-13
相关资源
最近更新 更多