android - Error when adding CardView to layout -


i wanted try out new toys google gave , i've run trouble.

here build.gradle:

apply plugin: 'com.android.application'  android {     compilesdkversion 'android-l'     buildtoolsversion "20.0.0"      defaultconfig {         applicationid "com.tod.android.lpreviewtest"         minsdkversion 'l'         targetsdkversion 'l'         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:+' } 

now layout:

<relativelayout xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:tools="http://schemas.android.com/tools"     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"     tools:context=".myactivity">     <android.support.v7.widget.cardview         xmlns:card_view="http://schemas.android.com/apk/res-auto"         android:id="@+id/card_view"         android:layout_gravity="center"         android:layout_width="200dp"         android:layout_height="200dp"         card_view:cardcornerradius="4dp">          <textview             android:id="@+id/info_text"             android:layout_width="match_parent"             android:layout_height="match_parent" />     </android.support.v7.widget.cardview> </relativelayout> 

when switch screen preview in android studio, render error:

rendering problems following classes not instantiated: - android.support.v7.widget.cardview (open class, show exception)  exception details java.lang.classformaterror: illegal field name "cardview.dark"          in class android/support/v7/cardview/r$style  @ java.lang.classloader.defineclass1(classloader.java:-2)   at java.lang.classloader.defineclass(classloader.java:792)   at  java.lang.classloader.defineclass(classloader.java:635)   at  java.lang.classloader.loadclass(classloader.java:424)   at  java.lang.classloader.loadclass(classloader.java:411)   at  java.lang.classloader.loadclass(classloader.java:357)   at  android.support.v7.widget.cardview.initialize(cardview.java:69)   at  android.support.v7.widget.cardview.<init>(cardview.java:60)   at  java.lang.reflect.constructor.newinstance(constructor.java:526)   at  android.view.layoutinflater.rinflate_original(layoutinflater.java:802)   at  android.view.layoutinflater_delegate.rinflate(layoutinflater_delegate.java:64)   at  android.view.layoutinflater.rinflate(layoutinflater.java:778)   at  android.view.layoutinflater.inflate(layoutinflater.java:500)   at  android.view.layoutinflater.inflate(layoutinflater.java:381) 

i tried ignoring error , running app in avd , while compiles fine, no cardview appears in layout. please help!

p.s. i'm using new android studio beta 0.8.0

this bug in android studio, see https://code.google.com/p/android/issues/detail?id=79071

one of comments of patch reads: "this causing card view rendering fail. cardview declared styles of form cardview.dark due generated r class failed load."

next version should have fixed according bug report (the patch on branch studio-1.0-dev). build project once workaround, not fix me (even though have same error , stack trace).


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -