Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FC #12

Closed
desugar-64 opened this issue Nov 6, 2014 · 17 comments
Closed

FC #12

desugar-64 opened this issue Nov 6, 2014 · 17 comments

Comments

@desugar-64
Copy link

Snackbar crashes, because textview in snackbar.xml and color in colors.xml had named by the same id snackbar_text.
It throw java.lang.NoSuchFieldError: No static field snackbar_text of type I in class Lcom/nispok/snackbar/R$id; or its superclasses (declaration of 'com.nispok.snackbar.R$id' at com.nispok.snackbar.Snackbar.init(Snackbar.java:226)

@wmora
Copy link
Contributor

wmora commented Nov 6, 2014

thanks for the notice! it shouldn't happen though, as one is R.color.snackbar_text and should be built with a different ID. Will upload the fix shortly

@wmora
Copy link
Contributor

wmora commented Nov 6, 2014

@sergeyfitis just uploaded v 2.0.1 to fix this, should be up soon. https://oss.sonatype.org/content/repositories/releases/com/nispok/snackbar/2.0.1/

@desugar-64
Copy link
Author

Ok, thanks.

@desugar-64
Copy link
Author

Build failing o_O

@wmora
Copy link
Contributor

wmora commented Nov 6, 2014

Yeah it's an issue with Travis. All tests pass when I run them with a Genymotion emulator. It seems like they changed something recently

@desugar-64
Copy link
Author

Snack bar still crashing with the same issue(v2.0.1) :(

@desugar-64
Copy link
Author

What I found:
It's generated R class in pakage /app/build/generated/source/r/debug/com/nispok/snackbar/R.java

public final class R {
public static final class anim {
public static final int snackbar_in = 0x7f04000a;
public static final int snackbar_out = 0x7f04000b;
}
public static final class color {
public static final int snackbar_action_text_color = 0x7f070052;
public static final int snackbar_background = 0x7f070053;
public static final int snackbar_text_color = 0x7f070054;
}
public static final class id {
}
public static final class layout {
public static final int snackbar = 0x7f030027;
}
public static final class style {
public static final int SnackbarText = 0x7f0c0079;
public static final int SnackbarText_Action = 0x7f0c007a;
}

Strange part is in section "public static final class id" (which must contains textview ids). But it is empty.
And we have java.lang.NoSuchFieldError: No static field snackbar_text of type I in class Lcom/nispok/snackbar/R$id; or its superclasses (declaration of 'com.nispok.snackbar.R$id' at com.nispok.snackbar.Snackbar.init(Snackbar.java:226).
I have Android studio v0.9.1. Hope this will help you.

@wmora
Copy link
Contributor

wmora commented Nov 7, 2014

Mmm weird. Can you provide some of your code? Have you tried the sample app? I've never had that problem

@desugar-64
Copy link
Author

Snackbar.with(getApplicationContext())
.text("Single-line snackbar")
.show(this);
I have not tried the sample app.

@desugar-64
Copy link
Author

Hmmm, I just update Android studio to 0.9.2, create new empty project. And your library works fine.
Sorry...

@wmora
Copy link
Contributor

wmora commented Nov 7, 2014

no worries! which version of AS you had before the upgrade?

@wmora wmora closed this as completed Nov 7, 2014
@desugar-64
Copy link
Author

0.9.1

@dyancat
Copy link

dyancat commented Nov 16, 2014

I'm just trying this out today and I'm getting this problem. Using the same code as above, with library v2.1.0, and Android Studio 0.9.3 and I get the id error. I'm not really sure how to go about fixing it

@wmora
Copy link
Contributor

wmora commented Nov 16, 2014

It's weird, which ID is your project not finding? Did you try cleaning/rebuilding the project? I just tested it and it works fine on a new project. How's your project setup? Are you running the code on a Fragment or an Activity?

@wmora wmora reopened this Nov 16, 2014
@dyancat
Copy link

dyancat commented Nov 16, 2014

It was the same snackbar_text id as above. I tried cleaning and rebuilding, no change. It was in an Activity.

However, this morning I tried again and it seems to be working. The only think I think I did differently was putting the library at the top of my dependencies list. But when I moved it around the list to test the effect, it started crashing again and wouldn't work when I put it back at the top.

I also thought using the this library: https://github.com/navasmdc/MaterialDesignLibrary
might be causing some kind of conflict since it includes its own snackbar, so I removed it from my project. Which made your snackbar library start working again, but when I added the MaterialDesignLibrary back, it still worked.

So it's working for me now but I'm not sure why

@wmora
Copy link
Contributor

wmora commented Nov 16, 2014

Ok thanks for the info. I'll take a look at that library

@wmora wmora closed this as completed Nov 16, 2014
@wmora
Copy link
Contributor

wmora commented Nov 16, 2014

I'll probably add a prefix to all resources. Didn't consider "snackbar" to be a common prefix. Thanks for reporting this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants