Android Studio error: cannot find symbol class AdapterViewCompat with compileSdkVersion 23 and buildToolsVersion '23.0.1'

Android Studio error: cannot find symbol class AdapterViewCompat with compileSdkVersion 23 and buildToolsVersion '23.0.1'

这是我的 gradle 文件,我正在 错误:

cannot find symbol
import android.support.v7.internal.widget.AdapterViewCompat;
error:package AdapterViewCompat does not exist. 

成绩如下:

apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'


android {
    compileSdkVersion 23
    buildToolsVersion '23.0.1'

 ...    

 dependencies 
 {
    compile 'com.android.support:cardview-v7:23.0.0'
    compile 'com.android.support:recyclerview-v7:23.0.0'
    compile 'com.android.support:design:23.0.0'
    compile 'com.android.support:appcompat-v7:23.1.0'
    compile 'com.android.support:gridlayout-v7:+'
    ...        
  }

android.support.v7.internal.widget.AdapterViewCompat;

编辑

您应该使用 buildToolsVersion "22.0.1",因为它在 23 中已过时。

这是因为

android.support.v7.internal.widget.AdapterViewCompat;

appcompat v23 中不存在(而 v22 中存在)。
您可以在

中查看
androidsdk\extras\android\m2repository\com\android\support\appcompat-v7.1.0\appcompat-v7-23.1.0-sources.jar

一般不要使用内部包里面的class。

如果您有现有代码,则将 AdapterViewCompat 更改为 AdapterView 并导入 android.widget.AdapterView; 如果您正在编写新代码,请使用 AdapterView 而不是 AdapterViewcompact,因为 AdapterViewCompact 在 api v23 或更高版本

中已弃用