WAI
Status Update
Comments
[Deleted User] <[Deleted User]> #2
The same error is thrown if you try to set a background programatically
myCard.setBackgroundResource(android.R.color.background_dark);
myCard.setBackgroundResource(android.R.color.background_dark);
yu...@gmail.com <yu...@gmail.com> #3
I am also having this issue when trying to set the background to a Drawable with CardView.setBackground(). This worked fine with the 21.0.0-rc-1 version of the CardView support library, but not with 21.0.0.
br...@gmail.com <br...@gmail.com> #4
Confirming this as well.
Changing the cardview background programmatically causes an IllegalClassCastException in CardViewEclairMr1.java:147 -->
private RoundRectDrawableWithShadow getShadowBackground(CardViewDelegate cardView) {
return ((RoundRectDrawableWithShadow) cardView.getBackground());
}
Could be me, but shouldn't getShadowBackground() only return Drawable? That way we would have to cast RoundRectDrawableWithShadow to elevation and radius getters and setters, but it would fix this issue.
Changing the cardview background programmatically causes an IllegalClassCastException in CardViewEclairMr1.java:147 -->
private RoundRectDrawableWithShadow getShadowBackground(CardViewDelegate cardView) {
return ((RoundRectDrawableWithShadow) cardView.getBackground());
}
Could be me, but shouldn't getShadowBackground() only return Drawable? That way we would have to cast RoundRectDrawableWithShadow to elevation and radius getters and setters, but it would fix this issue.
br...@gmail.com <br...@gmail.com> #5
CardView uses a custom background drawable to draw the card and shadows so you cannot set the background drawable/color on a card view.
In the next release, we'll add a method to set cardBackgroundColor(int color).
Would that be sufficient for your use case ?
In the next release, we'll add a method to set cardBackgroundColor(int color).
Would that be sufficient for your use case ?
ge...@gmail.com <ge...@gmail.com> #6
That would be sufficient for me; thank you!
br...@gmail.com <br...@gmail.com> #7
That sounds like it will solve the case where one needs to set the background to a color. However, IMHO, it would also be convenient to be able to set a Bitmap as the background so that the corners get rounded I *think* this was the behavior in the RC-1 version of the library. I know that it didn't throw an exception.
xa...@android.com <xa...@android.com> #8
By the way, setBackgroundColor(int color) works perfectly on the second L preview on my Nexus 5 for me. But, it crashes on KitKat.
ge...@gmail.com <ge...@gmail.com> #9
[Comment deleted]
br...@gmail.com <br...@gmail.com> #10
That would be great. Thanks.
I did exactly that yesterday, working fine so far down to Eclair.
I mainly needed the cards to change with the changing app theme (Material and Holo Light and Dark), which the library didn't do either. I guess that is intended, which made not being able to change to background color a real bummer. :)
I did exactly that yesterday, working fine so far down to Eclair.
I mainly needed the cards to change with the changing app theme (Material and Holo Light and Dark), which the library didn't do either. I guess that is intended, which made not being able to change to background color a real bummer. :)
xa...@android.com <xa...@android.com> #11
@showp1984, you can still change the background color via XML (which should cover your case for theme support). See attributes section for details:
https://developer.android.com/reference/android/support/v7/widget/CardView.html
@adam, CardView always used the background to draw so arbitrary background drawables were never supported. I assume in Preview 1, it was not detecting the bug. In the future we may support setting background drawable. No plans for it yet.
@adam, CardView always used the background to draw so arbitrary background drawables were never supported. I assume in Preview 1, it was not detecting the bug. In the future we may support setting background drawable. No plans for it yet.
[Deleted User] <[Deleted User]> #12
@ #11
Thank you for the hint. I'm not particularly fond of providing a XML for every theme though. This also doesn't allow for custom user colors and is bad for maintainability.
I fixed the issue as proposed in #5 and included the new module in my app.
Happy to know it will be addressed in a future release though.
Thank you for the hint. I'm not particularly fond of providing a XML for every theme though. This also doesn't allow for custom user colors and is bad for maintainability.
I fixed the issue as proposed in #5 and included the new module in my app.
Happy to know it will be addressed in a future release though.
lu...@gmail.com <lu...@gmail.com> #13
Until it's fixed, I use following hack to change background color.
Instead of this (causes IllegalClassCastException):
card.setBackgroundColor(Color.parseColor("#"+color));
I do this:
Drawable d = card.getBackground();
d.setColorFilter(Color.parseColor("#"+color), Mode.MULTIPLY);
card.setBackgroundDrawable(d);
Seems to be working with all devices I tried, i.e. Android Jelly Bean, KitKat. I have not yet had opportunity to test this with Lollipop though.
Instead of this (causes IllegalClassCastException):
card.setBackgroundColor(Color.parseColor("#"+color));
I do this:
Drawable d = card.getBackground();
d.setColorFilter(Color.parseColor("#"+color), Mode.MULTIPLY);
card.setBackgroundDrawable(d);
Seems to be working with all devices I tried, i.e. Android Jelly Bean, KitKat. I have not yet had opportunity to test this with Lollipop though.
ke...@gmail.com <ke...@gmail.com> #14
[Comment deleted]
[Deleted User] <[Deleted User]> #15
I tested with android Lollipop it does not work no background appears.
Here is the fix I propose :
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP){
Drawable d = card.getBackground();
d.setColorFilter(colorint, Mode.MULTIPLY);
}else{
childcontentOfCard.setBackgroundColor(colorint);
}
Here is the fix I propose :
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP){
Drawable d = card.getBackground();
d.setColorFilter(colorint, Mode.MULTIPLY);
}else{
childcontentOfCard.setBackgroundColor(colorint);
}
jo...@jmvo.se <jo...@jmvo.se> #16
That still isn't working for me. The original white background remains.
ke...@gmail.com <ke...@gmail.com> #17
Not sure why this hasn't been marked as released. CardView currently (I believe as of R21.0.2) has a new method setCardBackgroundColor() that appears to work fine.
ge...@gmail.com <ge...@gmail.com> #18
[Comment deleted]
jo...@jmvo.se <jo...@jmvo.se> #19
[Comment deleted]
jo...@jmvo.se <jo...@jmvo.se> #20
I get java.lang.classcast.exception for StateListDrawable. It occurs when i try to scroll the recyclerview while action mode is created.
I've used this library to create multi-selector feature for recyclerviews
https://github.com/bignerdranch/recyclerview-multiselect
This error occurs every time on 4.4.4, but not on 5.0 and occurs at times on 4.1.2.
I've attached the bug report.
I've used this library to create multi-selector feature for recyclerviews
This error occurs every time on 4.4.4, but not on 5.0 and occurs at times on 4.1.2.
I've attached the bug report.
lu...@gmail.com <lu...@gmail.com> #21
Here is the report.
mr...@gmail.com <mr...@gmail.com> #22
Wrapping the CardView in a FrameLayout fixed the issue.
br...@gmail.com <br...@gmail.com> #23
Can you please elaborate on what did you do with FrameLayout to solve the issue ?
I wrapped my CardView in FL and made foll changes in onCreateViewHolder()
View view = LayoutInflater.from( viewGroup.getContext( ) ).inflate( R.layout.card_layout, viewGroup, false );
View cardView = view.findViewById( R.id.card );
PerformanceViewHolder viewHolder = new PerformanceViewHolder( cardView );
return viewHolder;
Now it throws exception - MainApp : onCreate: uncaughtException: thread: ex.toString: java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.stack trace:
I wrapped my CardView in FL and made foll changes in onCreateViewHolder()
View view = LayoutInflater.from( viewGroup.getContext( ) ).inflate( R.layout.card_layout, viewGroup, false );
View cardView = view.findViewById( R.id.card );
PerformanceViewHolder viewHolder = new PerformanceViewHolder( cardView );
return viewHolder;
Now it throws exception - MainApp : onCreate: uncaughtException: thread: ex.toString: java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.stack trace:
du...@gmail.com <du...@gmail.com> #24
Please post your complete `PerformanceViewHolder` code and your fragment `onCreateView().`
mr...@gmail.com <mr...@gmail.com> #25
@brian - Thanks a bunch. Debugged, I had com.android.support:gridlayout-v7:+ in my gradle which was pulling 21.0.0-rc1
xa...@android.com <xa...@android.com> #26
If you see
+--- com.android.support:support-v4:19.1.+ -> 21.0.0-rc1
Then you must have another dependency on the same library somewhere else in your graph that pulls in 21.0.0-rc1.
See comment #12 for an example. The key part is this one:
+--- com.github.manuelpeinado.multichoiceadapter:multichoiceadapter-abc:3.0.1
| +--- com.github.manuelpeinado.multichoiceadapter:multichoiceadapter:3.0.1
| \--- com.android.support:appcompat-v7:[19.0,) -> 21.0.0-rc1 (*)
The library depends on anything above 19.0 so it picks up 21.0.0.
Gradle offers way to control this through it's resolution strategy feature.
For example you could do
configurations.all {
resolutionStrategy {
force 'com.android.support:appcompat-v7:19.1.0'
}
}
Reference:http://www.gradle.org/docs/current/dsl/org.gradle.api.artifacts.ResolutionStrategy.html
+--- com.android.support:support-v4:19.1.+ -> 21.0.0-rc1
Then you must have another dependency on the same library somewhere else in your graph that pulls in 21.0.0-rc1.
See
+--- com.github.manuelpeinado.multichoiceadapter:multichoiceadapter-abc:3.0.1
| +--- com.github.manuelpeinado.multichoiceadapter:multichoiceadapter:3.0.1
| \--- com.android.support:appcompat-v7:[19.0,) -> 21.0.0-rc1 (*)
The library depends on anything above 19.0 so it picks up 21.0.0.
Gradle offers way to control this through it's resolution strategy feature.
For example you could do
configurations.all {
resolutionStrategy {
force 'com.android.support:appcompat-v7:19.1.0'
}
}
Reference:
ge...@gmail.com <ge...@gmail.com> #27
@x You're right. One library require support-v4:+. When I use "exclude" directive, it resolves to 19.1.0 as intended. I think that this behaviour could be more docummented?
Anyway, thank you.
Anyway, thank you.
[Deleted User] <[Deleted User]> #28
IMHO, the problem is that the Android Support Repository should not include "rc" libraries. There should be another SDK package extra called "Android Support Repository (Preview)" that can have the "com.android.support:support-v4:21.0.0-rc1" library etc. When they're stable and recommended they can then be moved to the main repo.
da...@gmail.com <da...@gmail.com> #29
in reply to comment #27
nope: the problem is that people should NEVER use wildcard version in their dependencies (+) - (specially for libraries)
nope: the problem is that people should NEVER use wildcard version in their dependencies (+) - (specially for libraries)
le...@gmail.com <le...@gmail.com> #30
I'm getting a similar issue with a fresh install. As a new developer it's rather confusing with the new download.
- Download v 0.8.1 which then upgrades to 0.8.2
- Load the SDK Manager and all it gets by default is the Android L API 20 preview
- When you start a new project the nifty info-graphic tells me I should target Android 4.0.3 API 15 to maximize my app
- I go back to the SDK Manager and get API 15 files
- Create my first project ever and it wont load because of this error
If I was some sort of gradle ninja or long time Android developer then maybe the responses from people above of "just go edit some files" or "never wildcard" would make sense, but they don't.
app/build.gradle
android {
compileSdkVersion 20
buildToolsVersion "20.0.0"
defaultConfig {
applicationId "app.id "
minSdkVersion 15
targetSdkVersion 20
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
// You must install or update the Support Repository through the SDK manager to use this dependency.
compile 'com.android.support:support-v4:19.+'
}
Error:(24, 12) This support library should not use a lower version (19) than the targetSdkVersion (20)
Warning:(24, 12) A newer version of com.android.support:support-v4 than 19.+ is available: 21.0.0-rc1
I clicked clicked clicked through the GUI to get to this point so I'm confused because to me it's not intuitive what I did wrong.
- Download v 0.8.1 which then upgrades to 0.8.2
- Load the SDK Manager and all it gets by default is the Android L API 20 preview
- When you start a new project the nifty info-graphic tells me I should target Android 4.0.3 API 15 to maximize my app
- I go back to the SDK Manager and get API 15 files
- Create my first project ever and it wont load because of this error
If I was some sort of gradle ninja or long time Android developer then maybe the responses from people above of "just go edit some files" or "never wildcard" would make sense, but they don't.
app/build.gradle
android {
compileSdkVersion 20
buildToolsVersion "20.0.0"
defaultConfig {
applicationId "
minSdkVersion 15
targetSdkVersion 20
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
// You must install or update the Support Repository through the SDK manager to use this dependency.
compile 'com.android.support:support-v4:19.+'
}
Error:(24, 12) This support library should not use a lower version (19) than the targetSdkVersion (20)
Warning:(24, 12) A newer version of com.android.support:support-v4 than 19.+ is available: 21.0.0-rc1
I clicked clicked clicked through the GUI to get to this point so I'm confused because to me it's not intuitive what I did wrong.
da...@gmail.com <da...@gmail.com> #31
In reply to comment #29
you are right.
in the file you posted just change:
targetSdkVersion 20
to
targetSdkVersion 19
Some background: this year, at the Google I/O a developer preview of the Android operating system has been announced: Android L Preview
That has been assigned the target SDK version 20.
And since that version is NOT meant to be used in production (releasing app on the app store) if you chose that as version the system force you to target that version only.
What I told you to change is the version against which you compile your app, lowering to the last official released version.
Good luck!
you are right.
in the file you posted just change:
targetSdkVersion 20
to
targetSdkVersion 19
Some background: this year, at the Google I/O a developer preview of the Android operating system has been announced: Android L Preview
That has been assigned the target SDK version 20.
And since that version is NOT meant to be used in production (releasing app on the app store) if you chose that as version the system force you to target that version only.
What I told you to change is the version against which you compile your app, lowering to the last official released version.
Good luck!
mi...@gmail.com <mi...@gmail.com> #32
Solved the issue by adding this
compile('com.android.support:support-v4:19.1.0'){
force = true
}
*******
I think google is in panic mode to release Android Studio .. They want developers to test their product ..its funny.
compile('com.android.support:support-v4:19.1.0'){
force = true
}
*******
I think google is in panic mode to release Android Studio .. They want developers to test their product ..its funny.
re...@netmoms.de <re...@netmoms.de> #33
I ran into this issues after I tried to add the RecyclerView like explained here: http://stackoverflow.com/a/24441034/995926
Then I tried to fix this issue by resetting my project to the last stable version, which caused that I run into this bug:https://code.google.com/p/android/issues/detail?id=69270
I would guess that there is a bug in the local Android repository which comes with the Android SDK. I could fix this problem by deleting the directory $androidHome/extras/android/. I hope that will help anybody.
I would be happy to get some feedback from Xavier, what he thinks about it.
Then I tried to fix this issue by resetting my project to the last stable version, which caused that I run into this bug:
I would guess that there is a bug in the local Android repository which comes with the Android SDK. I could fix this problem by deleting the directory $androidHome/extras/android/. I hope that will help anybody.
I would be happy to get some feedback from Xavier, what he thinks about it.
pr...@gmail.com <pr...@gmail.com> #34
@x : Below dsl works properly. Just need one confirmation from you.
I have added this under android{} block in my gradle file. Is it a right place to do so? If not where should we put them?
configurations.all {
resolutionStrategy {
force 'com.android.support:appcompat-v7:19.1.0'
}
}
I have added this under android{} block in my gradle file. Is it a right place to do so? If not where should we put them?
configurations.all {
resolutionStrategy {
force 'com.android.support:appcompat-v7:19.1.0'
}
}
me...@gmail.com <me...@gmail.com> #35
Excluding the libraries from compile worked for me like:
compile ('com.github.manuelpeinado.fadingactionbar:fadingactionbar-abc:3.1.2'){
exclude group: 'com.android.support', module:'support-v4'
exclude group: 'com.android.support', module:'appcompat-v7'
}
compile ('com.github.manuelpeinado.fadingactionbar:fadingactionbar-abc:3.1.2'){
exclude group: 'com.android.support', module:'support-v4'
exclude group: 'com.android.support', module:'appcompat-v7'
}
ph...@borama.consulting <ph...@borama.consulting> #36
I migrated eclipse android project to android studio. I have many project library dependencies so I got a error message : "releaseJavaWithJavac > java.lang.NullPointerException."
Description
OS version: Ubuntu 14.04 LTS
Java JRE/JDK version: 1.7.0_60-b19 i386
Android Studio 0.6.1; Build 135.1224218
Gradle 1.11
Android-Gradle-Plugin 0.11.+
I just updated my SDK Tools, Platform tools and downloaded the new system images and SDK for Android L and Wear.
After open Android Studio this error appears:
Error:Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : uses-sdk:minSdkVersion 15 cannot be smaller than version 15 declared in library com.android.support:support-v4:21.0.0-rc1
My script is:
dependencies {
// Support
compile 'com.android.support:support-v4:19.1.+'
compile 'com.android.support:appcompat-v7:19.1.+'
// ...
}
android {
compileSdkVersion 19
buildToolsVersion "19.1.0"
defaultConfig {
applicationId ...
minSdkVersion 15
targetSdkVersion 19
}
// ...
}
I workaround, commenting the line:
<version>21.0.0-rc1</version>
In file "<android-sdk>/extras/android/m2repository/com/android/support-v4/maven-metadata.xml"