2

This is my gradle file and I am getting error:

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

Grade is as below:

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:+'
    ...        
  }
Gabriele Mariotti
  • 320,139
  • 94
  • 887
  • 841
Tarun Kundhiya
  • 156
  • 1
  • 9
  • Don't add the same dependency twice or more (ex: com.android.support:appcompat-v7) and use the same version for all support libraries:23.1.0 – Gabriele Mariotti Nov 09 '15 at 12:29

3 Answers3

4

It happens because the

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

doesn't exist in appcompat v23 (while it existed in v22).
You can check it in

androidsdk\extras\android\m2repository\com\android\support\appcompat-v7\23.1.0\appcompat-v7-23.1.0-sources.jar

In general don't use the class inside the internal package.

Gabriele Mariotti
  • 320,139
  • 94
  • 887
  • 841
2

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

Edit

You should use buildToolsVersion "22.0.1" because of Its obsolete in 23 .

IntelliJ Amiya
  • 74,896
  • 15
  • 165
  • 198
0

if you have existing code then change AdapterViewCompat to AdapterView and import android.widget.AdapterView; if you are writing new code then use AdapterView instead AdapterViewcompact as AdapterViewCompact deprecated in api v23 or higher

Saleem Kalro
  • 1,046
  • 9
  • 12