RhinoCan
Well-Known Member
I asked this question on StackExchange and it has been viewed a few times but no one has answered it after several days so I thought I'd try here....
I am new to Android development in general and Android Studio (AS) in particular. I have the current version (3.1.2) installed and it's mostly working well but I'm not very clear on something. I don't have all the terminology yet so forgive me for putting this in a slightly roundabout way.
I gather that AS comes with a certain set of classes to enable me to do a great many standard things. However, in some cases, I will want to add additional classes to AS to do things that are not built into the IDE. This, of course, is expected and allowed for by the developers. However, I'm not clear on how to do so.
For example, I am imitating some code I found in a tutorial and it calls for a Snackbar to be created. I copied in the code that creates the Snackbar but AS highlights the word Snackbar in red. I understand that this means that the Snackbar class isn't built into AS. Even though I have the AS set to generate imports automatically the first time I use a class in a program, that doesn't work for Snackbar and even hand-coding the import doesn't work.
Clearly, I need to do something to add the Snackbar class (and any of its dependencies) to AS. I started poking around and found this reply to a question about adding Snackbar to AS: Android design support library - version number and gradle error. From that response, I learned that the person asking that question knew that he needed to add a dependency but couldn't get the dependency to work and was asking about it.
Now, I'm not as smart/experienced as that person so I'd like to know a few things: 1. If I get a class name highlighted in red, does it ALWAYS mean that I need to add a dependency to Gradle (once I've ruled out spelling errors)? 2. How do I determine WHICH dependency (and LEVEL) needs to be added to Gradle?
There seem to be several Snackbar classes, including android.support.design.widget.Snackbar and https://developer.android.com/reference/com/google/android/material/snackbar/package-summary. How do I know which one I need? I'm guessing that one was an earlier version that was rolled out as a standalone class and that the other is a later version that was more closely integrated with the rest of the class structure but I'm not sure how to tell which is the "latest and greatest". Then, once I know that, I need to find out the name of the dependency that will resolve the issue and then the current highest level of that dependency.
Can someone explain to me how all that is done? I'd be very grateful if someone could help me with that.
I am new to Android development in general and Android Studio (AS) in particular. I have the current version (3.1.2) installed and it's mostly working well but I'm not very clear on something. I don't have all the terminology yet so forgive me for putting this in a slightly roundabout way.
I gather that AS comes with a certain set of classes to enable me to do a great many standard things. However, in some cases, I will want to add additional classes to AS to do things that are not built into the IDE. This, of course, is expected and allowed for by the developers. However, I'm not clear on how to do so.
For example, I am imitating some code I found in a tutorial and it calls for a Snackbar to be created. I copied in the code that creates the Snackbar but AS highlights the word Snackbar in red. I understand that this means that the Snackbar class isn't built into AS. Even though I have the AS set to generate imports automatically the first time I use a class in a program, that doesn't work for Snackbar and even hand-coding the import doesn't work.
Clearly, I need to do something to add the Snackbar class (and any of its dependencies) to AS. I started poking around and found this reply to a question about adding Snackbar to AS: Android design support library - version number and gradle error. From that response, I learned that the person asking that question knew that he needed to add a dependency but couldn't get the dependency to work and was asking about it.
Now, I'm not as smart/experienced as that person so I'd like to know a few things: 1. If I get a class name highlighted in red, does it ALWAYS mean that I need to add a dependency to Gradle (once I've ruled out spelling errors)? 2. How do I determine WHICH dependency (and LEVEL) needs to be added to Gradle?
There seem to be several Snackbar classes, including android.support.design.widget.Snackbar and https://developer.android.com/reference/com/google/android/material/snackbar/package-summary. How do I know which one I need? I'm guessing that one was an earlier version that was rolled out as a standalone class and that the other is a later version that was more closely integrated with the rest of the class structure but I'm not sure how to tell which is the "latest and greatest". Then, once I know that, I need to find out the name of the dependency that will resolve the issue and then the current highest level of that dependency.
Can someone explain to me how all that is done? I'd be very grateful if someone could help me with that.