I'm testing the new API 21, I try to create a RecyclerView but I'm stuck with a dependency problem.
The error look like that
my layout :
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin">
<!-- A RecyclerView with some commonly used attributes -->
<android.support.v7.widget.RecyclerView
android:id="@+id/mRecyclerView"
android:scrollbars="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</RelativeLayout>
and my gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "20.0.0"
defaultConfig {
applicationId "com.agonist.samplify"
minSdkVersion 17
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:cardview-v7:+'
compile 'com.android.support:recyclerview-v7:+'
}
I don't know what to do. I tried to clean/build the project but it stay here. Any idea ?
EDIT : Finnaly it's only an IDE preview problems. During execution everything works
The new RecyclerView does not yet work in Studio. Google are working on a fix. (Open Issue 72117)
Your API and RecyclerView version should be same
Sync Gradle like :
compileSdkVersion 23
buildToolsVersion "23.0.1"
And
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:recyclerview-v7:23.0.1'
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With